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.

Author pablogsal
Recipients Esa.Peuha, Mark.Shannon, RJ722, Rosuav, cheryl.sabella, lys.nikolaou, mbussonn, ncoghlan, pablogsal, r.david.murray, terry.reedy
Date 2020-06-30.17:26:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593538015.42.0.705992959905.issue19335@roundup.psfhosted.org>
In-reply-to
Content
> 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
History
Date User Action Args
2020-06-30 17:26:55pablogsalsetrecipients: + pablogsal, terry.reedy, ncoghlan, r.david.murray, Mark.Shannon, Rosuav, Esa.Peuha, mbussonn, cheryl.sabella, lys.nikolaou, RJ722
2020-06-30 17:26:55pablogsalsetmessageid: <1593538015.42.0.705992959905.issue19335@roundup.psfhosted.org>
2020-06-30 17:26:55pablogsallinkissue19335 messages
2020-06-30 17:26:55pablogsalcreate