Closed
Description
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 a loop_forever.py
containing:
import os
print(os.getpid())
x = 1
while x == 1:
pass
print(f"{x=}")
and an injected.py
containing:
x = 42
Using sys.remote_exec()
to inject injected.py
into an interpreter running loop_forever.py
results in x=42
being printed out and the script exiting.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response