[issue46153] function fails in exec when locals is given

Quentin Peter report at bugs.python.org
Wed Dec 22 12:49:50 EST 2021


Quentin Peter <qpeter at bluewin.ch> added the comment:

Thank you for your explaination. Just to be sure, it is expected that:

exec("a = 1\ndef f(): return a\nprint(f())", {})

Runs successfully but

exec("a = 1\ndef f(): return a\nprint(f())", {}, {})

Doesn't?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46153>
_______________________________________


More information about the Python-bugs-list mailing list