Pablo Galindo Salgado <[email protected]> added the comment:
> 1) We should alter code in symtable.c to check whether the namespace in which
> the nonlocal statement appears in is a function block and whether it is
> nested or not.
We already raise in this case. Consider this 'test.py' file:
x = 34
def f():
nonlocal x
x = 24
f()
Executing python test.py:
File "test.py", line 3
nonlocal x
^
SyntaxError: no binding for nonlocal 'x' found
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue19335>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com