This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Idle 2.7 -c, -r compile with print as function.
Type: behavior Stage: resolved
Components: IDLE Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: benjamin.peterson, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2015-05-18 01:19 by terry.reedy, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg243446 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-18 01:19
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 syntax

https://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.
msg243525 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-18 19:37
New changeset cebd51686565 by Terry Jan Reedy in branch '2.7':
Issue #24222: Fix regression introduced with idlelib/PyShell.py future print
https://hg.python.org/cpython/rev/cebd51686565
msg243526 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-18 19:38
I added "from __future__ import print_function" to 2.7 PyShell when I backported the bugfix of #22420.  The use of print rather than write is part of the fix as print is more fault tolerant.
msg243529 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-18 19:53
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.)
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68410
2019-03-21 18:20:35terry.reedysetcomponents: + IDLE
2015-05-18 19:53:27terry.reedysetnosy: + benjamin.peterson
messages: + msg243529
2015-05-18 19:38:30terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg243526

stage: needs patch -> resolved
2015-05-18 19:37:52python-devsetnosy: + python-dev
messages: + msg243525
2015-05-18 01:19:47terry.reedycreate