Quentin Peter <qpe...@bluewin.ch> added the comment:
The reason I am asking is that I am working on a debugger. The debugger stops on a frame which is inside a function. Let's say the locals is: locals() == {"a": 1} I now want to define a closure with exec. I might want to do something like: exec("def f(): return a", globals(), locals()) But this doesn't work because of the issue I describe.I would expect f() to look for a in the locals(). Even more surprising is that if I use the second argument of exec, the code in the above comment starts to fail. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46153> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com