mirror of
https://github.com/python/cpython.git
synced 2024-12-03 23:06:43 +08:00
gh-104536: Improve multiprocessing.process._cleanup
logic (#104537)
Fix a race condition in the internal `multiprocessing.process` cleanup logic that could manifest as an unintended `AttributeError` when calling `BaseProcess.close()`. --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
b9c807a260
commit
ef5d00a592
@ -61,7 +61,7 @@ def parent_process():
|
||||
def _cleanup():
|
||||
# check for processes which have finished
|
||||
for p in list(_children):
|
||||
if p._popen.poll() is not None:
|
||||
if (child_popen := p._popen) and child_popen.poll() is not None:
|
||||
_children.discard(p)
|
||||
|
||||
#
|
||||
|
@ -0,0 +1,3 @@
|
||||
Fix a race condition in the internal :mod:`multiprocessing.process` cleanup
|
||||
logic that could manifest as an unintended ``AttributeError`` when calling
|
||||
``process.close()``.
|
Loading…
Reference in New Issue
Block a user