mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-83856: Honor atexit for all multiprocessing start methods (GH-114279)
Use atexit for all multiprocessing start methods to cleanup. See the GH-114279 PR discussion and related issue for details as to why.
This commit is contained in:
parent
cb57a52a85
commit
998c3856c1
5 changed files with 34 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
|||
import atexit
|
||||
import os
|
||||
import signal
|
||||
|
||||
|
@ -66,10 +67,13 @@ class Popen(object):
|
|||
self.pid = os.fork()
|
||||
if self.pid == 0:
|
||||
try:
|
||||
atexit._clear()
|
||||
atexit.register(util._exit_function)
|
||||
os.close(parent_r)
|
||||
os.close(parent_w)
|
||||
code = process_obj._bootstrap(parent_sentinel=child_r)
|
||||
finally:
|
||||
atexit._run_exitfuncs()
|
||||
os._exit(code)
|
||||
else:
|
||||
os.close(child_w)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue