Message11298

Author pjac
Recipients CecilWesterhof, fwierzbicki, irmen, jaraco, pjac, zyasoft
Date 2017-04-05.15:25:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491405924.54.0.434558614042.issue2007@psf.upfronthosting.co.za>
In-reply-to
Content
I can confirm this does not just fail at the interactive prompt, it also fails in the context of doctests.

Test case provided:


Desired output shown from (Apple provided) Python 2.7.10 on macOS,

$ python print_doctest.py 
Trying:
    print(1, 2, 3)
Expecting:
    1 2 3
ok
1 items passed all tests:
   1 tests in __main__
1 tests in 1 items.
1 passed and 0 failed.
Test passed.
Darwin-16.4.0-x86_64-i386-64bit
2.7.10 (default, Jul 30 2016, 19:40:32) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

Desired output shown from (self-compiled) Python 3.6 on macOS,

$ python3.6 print_doctest.py 
Trying:
    print(1, 2, 3)
Expecting:
    1 2 3
ok
1 items passed all tests:
   1 tests in __main__
1 tests in 1 items.
1 passed and 0 failed.
Test passed.
Darwin-16.4.0-x86_64-i386-64bit
3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

Problematic output from Jython 2.7 installed using jython-installer-2.7.0.jar on macOS,


$ jython print_doctest.py 
Trying:
    print(1, 2, 3)
Expecting:
    1 2 3
**********************************************************************
File "print_doctest.py", line 16, in __main__
Failed example:
    print(1, 2, 3)
Expected:
    1 2 3
Got:
    (1, 2, 3)
**********************************************************************
1 items had failures:
   1 of   1 in __main__
1 tests in 1 items.
0 passed and 1 failed.
***Test Failed*** 1 failures.
Java-1.8.0_121-Java_HotSpot-TM-_64-Bit_Server_VM,_25.121-b13,_Oracle_Corporation-on-Mac_OS_X-10.12.3-x86_64
2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]


The test script:



$ cat print_doctest.py 
"""Jython print_function doctest example.

Under Python 2 by default, print(1, 2, 3) would be seen as
a print statement given a tuple, and give:

   (1, 2, 3)

Under Python 3 by default, it would be seen as a call to the
print function and give:

   1 2 3

Let's try it in a doctest where we've explicitly asked for a
print function via the future import.

   >>> print(1, 2, 3)
   1 2 3

"""

from __future__ import print_function
import doctest
import sys
import platform

doctest.testmod(verbose=2)
print(platform.platform())
print(sys.version)
History
Date User Action Args
2017-04-05 15:25:24pjacsetmessageid: <1491405924.54.0.434558614042.issue2007@psf.upfronthosting.co.za>
2017-04-05 15:25:24pjacsetrecipients: + pjac, fwierzbicki, irmen, jaraco, zyasoft, CecilWesterhof
2017-04-05 15:25:24pjaclinkissue2007 messages
2017-04-05 15:25:23pjaccreate