summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/process.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-17 10:36:26 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-17 10:36:26 (GMT)
commit3bcc0170bdd5dca6b87c12c7894454e352b53492 (patch)
treeb4fc5e62be84b98b8e9c38f29f00bfc131dd9ed8 /Lib/multiprocessing/process.py
parentac6602bdc17973c121ea6cce9ae6768a9e5db8c3 (diff)
parent0f83b1511c76e892b48b16d656cceb032bdb9cb3 (diff)
downloadcpython-3bcc0170bdd5dca6b87c12c7894454e352b53492.zip
cpython-3bcc0170bdd5dca6b87c12c7894454e352b53492.tar.gz
cpython-3bcc0170bdd5dca6b87c12c7894454e352b53492.tar.bz2
(Merge 3.2) Issue #12310: finalize the old process after _run_after_forkers()
multiprocessing: Process._bootstrap() keeps a reference to the old process to delay its finalization until after _run_after_forkers() as been executed. This change should fix a crash on Mac OS X Tiger when a lock is released after a fork. Patch written by Charles-François Nataliv and Antoine Pitrou.
Diffstat (limited to 'Lib/multiprocessing/process.py')
-rw-r--r--Lib/multiprocessing/process.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py
index 99ee532..86c291e 100644
--- a/Lib/multiprocessing/process.py
+++ b/Lib/multiprocessing/process.py
@@ -267,9 +267,15 @@ class Process(object):
sys.stdin = open(os.devnull)
except (OSError, ValueError):
pass
+ old_process = _current_process
_current_process = self
- util._finalizer_registry.clear()
- util._run_after_forkers()
+ try:
+ util._finalizer_registry.clear()
+ util._run_after_forkers()
+ finally:
+ # delay finalization of the old process object until after
+ # _run_after_forkers() is executed
+ del old_process
util.info('child process calling self.run()')
try:
self.run()