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 BTaskaya
Recipients BTaskaya, gvanrossum, lys.nikolaou
Date 2020-12-23.20:41:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608756094.7.0.944899403116.issue42725@roundup.psfhosted.org>
In-reply-to
Content
This is another side effect of processing annotations (at the symbol table construction stage) (and I would assume there are a few more cases like this);

def foo():
    outer_var = 1

    def bar():
        inner_var: outer_var = T
    
    return bar

inner = foo()
print(inner.__closure__)

In theory, there shouldn't be any cells / references to the variables from outer scope, but since we process the entry for the annotation and record `outer_var` as a free var it is listed here.
History
Date User Action Args
2020-12-23 20:41:34BTaskayasetrecipients: + BTaskaya, gvanrossum, lys.nikolaou
2020-12-23 20:41:34BTaskayasetmessageid: <1608756094.7.0.944899403116.issue42725@roundup.psfhosted.org>
2020-12-23 20:41:34BTaskayalinkissue42725 messages
2020-12-23 20:41:34BTaskayacreate