Issue 24222: Idle 2.7 -c, -r compile with print as function. (original) (raw)

Issue24222

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:17 admin set github: 68410
2019-03-21 18:20:35 terry.reedy set components: + IDLE
2015-05-18 19:53:27 terry.reedy set nosy: + benjamin.petersonmessages: +
2015-05-18 19:38:30 terry.reedy set status: open -> closedresolution: fixedmessages: + stage: needs patch -> resolved
2015-05-18 19:37:52 python-dev set nosy: + python-devmessages: +
2015-05-18 01:19:47 terry.reedy create