You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scripts injected by sys.remote_exec run in the context of the __main__ module, meaning that they unintentionally overwrite variables used in the main script. For instance, given a loop_forever.py containing:
Run debugger scripts in their own namespaces
Previously scripts injected by `sys.remote_exec` were run with the
globals of the `__main__` module. Instead, run each injected script
with an empty set of globals. If someone really wants to use the
`__main__` module's namespace, they can always `import __main__`.
Bug report
Bug description:
The scripts injected by
sys.remote_exec
run in the context of the__main__
module, meaning that they unintentionally overwrite variables used in the main script. For instance, given aloop_forever.py
containing:and an
injected.py
containing:Using
sys.remote_exec()
to injectinjected.py
into an interpreter runningloop_forever.py
results inx=42
being printed out and the script exiting.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: