[Python-checkins] bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19477)

Dong-hee Na webhook-mailer at python.org
Tue Apr 14 09:16:00 EDT 2020


https://github.com/python/cpython/commit/e1945307d36849f8be8937144cf3dd6ebab6274c
commit: e1945307d36849f8be8937144cf3dd6ebab6274c
branch: master
author: Dong-hee Na <donghee.na92 at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-04-14T22:15:52+09:00
summary:

bpo-40221: Update multiprocessing to use _at_fork_reinit (GH-19477)

files:
M Lib/multiprocessing/util.py

diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 32c7a96d2534d..21f2a7ebe2500 100644
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -367,13 +367,13 @@ def _exit_function(info=info, debug=debug, _run_finalizers=_run_finalizers,
 
 class ForkAwareThreadLock(object):
     def __init__(self):
-        self._reset()
-        register_after_fork(self, ForkAwareThreadLock._reset)
-
-    def _reset(self):
         self._lock = threading.Lock()
         self.acquire = self._lock.acquire
         self.release = self._lock.release
+        register_after_fork(self, ForkAwareThreadLock._at_fork_reinit)
+
+    def _at_fork_reinit(self):
+        self._lock._at_fork_reinit()
 
     def __enter__(self):
         return self._lock.__enter__()



More information about the Python-checkins mailing list