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 coproc, pablogsal
Date 2020-04-06.09:49:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586166596.99.0.53523285954.issue40196@roundup.psfhosted.org>
In-reply-to
Content
>>> code2 = """\
... def foo():
...    x = 42
...    def bar():
...       return -1
... """
>>> top.get_children()[0]
<Function SymbolTable for foo in ?>
>>> top = symtable.symtable(code2, "?", "exec")
>>> top.get_children()[0].lookup('x')._Symbol__scope == symtable.LOCAL
True

but if we return x from bar:

That fix is not correct. For instance consider:

>>> code = """\
... def foo():
...    x = 42
...    def bar():
...       return x
... """
>>> import symtable
>>> top = symtable.symtable(code, "?", "exec")
>>> top.get_children()[0].lookup('x')._Symbol__scope == symtable.LOCAL
False
History
Date User Action Args
2020-04-06 10:06:55pablogsalunlinkissue40196 messages
2020-04-06 09:49:57pablogsalsetrecipients: + pablogsal, coproc
2020-04-06 09:49:56pablogsalsetmessageid: <1586166596.99.0.53523285954.issue40196@roundup.psfhosted.org>
2020-04-06 09:49:56pablogsallinkissue40196 messages
2020-04-06 09:49:56pablogsalcreate