changeset: 70831:e6e7e42efdc2 branch: 3.2 parent: 70827:505fb7045aad user: Victor Stinner date: Fri Jun 17 12:31:49 2011 +0200 files: Lib/multiprocessing/process.py description: 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. diff -r 505fb7045aad -r e6e7e42efdc2 Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py Thu Jun 16 18:51:24 2011 -0500 +++ b/Lib/multiprocessing/process.py Fri Jun 17 12:31:49 2011 +0200 @@ -251,9 +251,15 @@ 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()