Batuhan Taskaya <[email protected]> added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42725>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com