mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
gh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (GH-98462)
This commit is contained in:
parent
cb93b4aee5
commit
e48f9b2b7e
4 changed files with 62 additions and 3 deletions
|
|
@ -54,19 +54,20 @@ def __init__(self, process_obj):
|
|||
wfd = msvcrt.open_osfhandle(whandle, 0)
|
||||
cmd = spawn.get_command_line(parent_pid=os.getpid(),
|
||||
pipe_handle=rhandle)
|
||||
cmd = ' '.join('"%s"' % x for x in cmd)
|
||||
|
||||
python_exe = spawn.get_executable()
|
||||
|
||||
# bpo-35797: When running in a venv, we bypass the redirect
|
||||
# executor and launch our base Python.
|
||||
if WINENV and _path_eq(python_exe, sys.executable):
|
||||
python_exe = sys._base_executable
|
||||
cmd[0] = python_exe = sys._base_executable
|
||||
env = os.environ.copy()
|
||||
env["__PYVENV_LAUNCHER__"] = sys.executable
|
||||
else:
|
||||
env = None
|
||||
|
||||
cmd = ' '.join('"%s"' % x for x in cmd)
|
||||
|
||||
with open(wfd, 'wb', closefd=True) as to_child:
|
||||
# start process
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue