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>
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)
#
--- /dev/null
+Fix a race condition in the internal :mod:`multiprocessing.process` cleanup
+logic that could manifest as an unintended ``AttributeError`` when calling
+``process.close()``.