mirror of
https://github.com/python/cpython.git
synced 2025-09-19 15:10:58 +00:00
(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.
This commit is contained in:
commit
3bcc0170bd
1 changed files with 8 additions and 2 deletions
|
@ -267,9 +267,15 @@ class Process(object):
|
||||||
sys.stdin = open(os.devnull)
|
sys.stdin = open(os.devnull)
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
old_process = _current_process
|
||||||
_current_process = self
|
_current_process = self
|
||||||
|
try:
|
||||||
util._finalizer_registry.clear()
|
util._finalizer_registry.clear()
|
||||||
util._run_after_forkers()
|
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()')
|
util.info('child process calling self.run()')
|
||||||
try:
|
try:
|
||||||
self.run()
|
self.run()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue