Revert "bpo-33929: multiprocessing: fix handle leak on race condition (GH-7921)" (GH-7963)
This reverts commit 8b1ebcd7cb3319273ea635df78ebf9ad40171514.
diff --git a/Lib/multiprocessing/reduction.py b/Lib/multiprocessing/reduction.py
index 473fd59..deca19c 100644
--- a/Lib/multiprocessing/reduction.py
+++ b/Lib/multiprocessing/reduction.py
@@ -68,16 +68,12 @@
__all__ += ['DupHandle', 'duplicate', 'steal_handle']
import _winapi
- def duplicate(handle, target_process=None, inheritable=False,
- *, source_process=None):
+ def duplicate(handle, target_process=None, inheritable=False):
'''Duplicate a handle. (target_process is a handle not a pid!)'''
- current_process = _winapi.GetCurrentProcess()
- if source_process is None:
- source_process = current_process
if target_process is None:
- target_process = current_process
+ target_process = _winapi.GetCurrentProcess()
return _winapi.DuplicateHandle(
- source_process, handle, target_process,
+ _winapi.GetCurrentProcess(), handle, target_process,
0, inheritable, _winapi.DUPLICATE_SAME_ACCESS)
def steal_handle(source_pid, handle):