Commit 0aab8660 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-33929: Fix regression in spawn_main() (#7962)

OpenProcess() creates a new handle that must be closed later.
parent 2cc9d21f
......@@ -103,8 +103,12 @@ def spawn_main(pipe_handle, parent_pid=None, tracker_fd=None):
_winapi.PROCESS_DUP_HANDLE, False, parent_pid)
else:
source_process = None
new_handle = reduction.duplicate(pipe_handle,
source_process=source_process)
try:
new_handle = reduction.duplicate(pipe_handle,
source_process=source_process)
finally:
if source_process is not None:
_winapi.CloseHandle(source_process)
fd = msvcrt.open_osfhandle(new_handle, os.O_RDONLY)
else:
from . import semaphore_tracker
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment