diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index fe4ee3348c8..a0b3d68f9fc 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -233,6 +233,7 @@ def __init__(self, process_obj): self.returncode = None self._handle = hp self.sentinel = int(hp) + util.Finalize(self, _winapi.CloseHandle, (self.sentinel,)) # send information to child Popen._tls.process_handle = int(hp) diff --git a/Misc/NEWS b/Misc/NEWS index 870b7454d2d..7ffbd7b1351 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -127,6 +127,8 @@ Core and Builtins Library ------- +- Issue #16481: multiprocessing no longer leaks process handles on Windows. + - Issue #12428: Add a pure Python implementation of functools.partial(). Patch by Brian Thorne.