You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Idle 2.7 -c, -r compile with print as function. #68410
I added "from __future__ import print_function" to 2.7 PyShell when I backported the bugfix of bpo-22420. The use of print rather than write is part of the fix as print is more fault tolerant.
This trivial patch fixes a regression I introduced in 2.7.9. It would be nice if you could pull it into the .10 release. (I would not ask if it were not a recent regression.)
Activity
terryjreedy commentedon May 18, 2015
C:\Users\Terry>py -2 -m idlelib.idle -c "print True" >>> *** Error in script or command! Traceback (most recent call last): File "<pyshell#0>", line 1 print True ^ SyntaxError: invalid syntaxhttps://stackoverflow.com/questions/30280525/python-idle-give-a-false-syntax-error
In answer, phihag points out that PyShell.py has future import and compiles with
code = compile(source, filename, "exec")
The fix is to add dont_inherit=True.
python-dev commentedon May 18, 2015
New changeset cebd51686565 by Terry Jan Reedy in branch '2.7':
Issue bpo-24222: Fix regression introduced with idlelib/PyShell.py future print
https://hg.python.org/cpython/rev/cebd51686565
terryjreedy commentedon May 18, 2015
I added "from __future__ import print_function" to 2.7 PyShell when I backported the bugfix of bpo-22420. The use of print rather than write is part of the fix as print is more fault tolerant.
terryjreedy commentedon May 18, 2015
This trivial patch fixes a regression I introduced in 2.7.9. It would be nice if you could pull it into the .10 release. (I would not ask if it were not a recent regression.)