New submission from Chris Angelico:
IDLE tries to be helpful, but it errors on something that isn't yet an error.
Pasting in this code works fine:
def a():
def b():
nonlocal q
q+=1
q=1
b()
return q
a()
2
But typing it, line by
Terry J. Reedy added the comment:
This started as a python-list thread. On that thread, Peter Otten verified the
behavior on Linux, so it is not specific to the Windows pythonw executable. He
also verified on 3.2 (which gets security fixes only) and 3.4. I just checked
2.7. On that thread, I
Terry J. Reedy added the comment:
A test will be a challenge since the three lines have to be run as if entered
interactively. This may require new code to inject lines into the interactive
processing stream, or a least a re-factoring of existing code.
--