4 ms·
See PyFrame_FastToLocals() in the CPython source. Try wrapping your code in a function and notice the changes are no longer mirrored. Calls to exec() and eval(
by _wmd 9y ago
See PyFrame_FastToLocals() in the CPython source.
Try wrapping your code in a function and notice the changes are no longer mirrored. Calls to exec() and eval() cause PyFrame_FastToLocals() to be applied afterwards, as used by the interactive console, but this doesn't happen during normal execution