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: __future__ flags don't clear on shell restart
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: ezio.melotti, ned.deily, python-dev, roger.serwy
Priority: normal Keywords: patch

Created on 2011-10-30 17:24 by roger.serwy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch_future.diff roger.serwy, 2011-10-30 17:24
Messages (3)
msg146646 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-10-30 17:24
The interactive interpreter in IDLE does not reset its compiler __future__ flags when you restart the shell. 

To verify this, type into the shell:
    
    >>> from __future__ import barry_as_FLUFL
    >>> 1 != 2

You'll get a syntax error. Restart the shell and type

    >>> 1 != 2

A syntax error still occurs.

The ModifiedInterpreter class in PyShell.py ultimately relies on codeop to mimic the interactive prompt. The codeop module was created specifically for remembering __future__ flags for subsequent commands. 

The provided patch stores the flags of the interpreter when it first initializes, and then restores them in "restart_subprocess". It's a patch against 3.2.2.
msg146673 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-10-31 03:06
New changeset 87251608cb64 by Ned Deily in branch '2.7':
Issue 13296: Fix IDLE to clear compile __future__ flags on shell restart.
http://hg.python.org/cpython/rev/87251608cb64

New changeset 9fbf79d6be56 by Ned Deily in branch '3.2':
Issue 13296: Fix IDLE to clear compile __future__ flags on shell restart.
http://hg.python.org/cpython/rev/9fbf79d6be56

New changeset d8acd4344ce9 by Ned Deily in branch 'default':
Issue 13296: Fix IDLE to clear compile __future__ flags on shell restart.
http://hg.python.org/cpython/rev/d8acd4344ce9
msg146674 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-31 03:08
Thanks for the patch!  Committed to 27 (for release in 2.7.3), 32 (for 3.2.3), and default (for 3.3).
History
Date User Action Args
2022-04-11 14:57:23adminsetgithub: 57505
2011-10-31 03:08:35ned.deilysetstatus: open -> closed

assignee: ned.deily
versions: + Python 3.3, - Python 2.6, Python 3.1
nosy: + ned.deily

messages: + msg146674
resolution: fixed
stage: resolved
2011-10-31 03:06:28python-devsetnosy: + python-dev
messages: + msg146673
2011-10-30 17:24:51roger.serwycreate