[New-bugs-announce] [issue19335] IDLE over-enthusiastically verifies 'nonlocal' usage

Chris Angelico report at bugs.python.org
Mon Oct 21 18:30:00 CEST 2013


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 line, results in an error:

>>> def a():
	def b():
		nonlocal q
		
SyntaxError: no binding for nonlocal 'q' found

This doesn't occur with interactive command-line Python. A small issue, more of curiosity value than anything else - I don't have a non-trivial use-case where this causes problems.

----------
components: IDLE
messages: 200809
nosy: Rosuav
priority: normal
severity: normal
status: open
title: IDLE over-enthusiastically verifies 'nonlocal' usage
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19335>
_______________________________________


More information about the New-bugs-announce mailing list