Issue 13296: IDLE: future flags don't clear on shell restart (original) (raw)

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.