diff options
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/process.py | 10 |
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() |