Message409038
When both namespace arguments are given to exec, function definitions fail to capture closure. See below:
```
Python 3.8.6 (default, Oct 8 2020, 14:06:32)
[Clang 12.0.0 (clang-1200.0.32.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exec("a = 1\ndef f(): return a\nprint(f())")
1
>>> exec("a = 1\ndef f(): return a\nprint(f())", {})
1
>>> exec("a = 1\ndef f(): return a\nprint(f())", {}, {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 3, in <module>
File "<string>", line 2, in f
NameError: name 'a' is not defined
>>>
``` |
|
Date |
User |
Action |
Args |
2021-12-22 15:38:00 | qpeter | set | recipients:
+ qpeter |
2021-12-22 15:38:00 | qpeter | set | messageid: <1640187480.74.0.946037624707.issue46153@roundup.psfhosted.org> |
2021-12-22 15:38:00 | qpeter | link | issue46153 messages |
2021-12-22 15:38:00 | qpeter | create | |
|