[issue43448] exec() ignores scope.

2021-03-10 Thread Mark Dickinson
Mark Dickinson added the comment: > At most I think this issue is a duplicate of bpo-24800 Agreed; closing here. -- nosy: +mark.dickinson resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> exec docs should note that the no argument form in a local sc

[issue43448] exec() ignores scope.

2021-03-09 Thread Eryk Sun
Eryk Sun added the comment: exec(obj, globals(), locals()) is the same as exec(obj). Also, locals in a function scope are optimized, so the locals() dict is a snapshot. Modifying the snapshot dict doesn't modify the optimized local variables. At most I think this issue is a duplicate of bpo-

[issue43448] exec() ignores scope.

2021-03-09 Thread Keepun
New submission from Keepun : exec() ignores scope. Code: -- class ExecTest: def public(self): h=None exec("h='It is public'") print(h) self._private() def _private(self): h=None exec("h='It is private'", globals(),