[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

Steve Dower report at bugs.python.org
Tue Jun 25 21:56:21 EDT 2019


Steve Dower <steve.dower at python.org> added the comment:

The handle can deliberately live beyond the process, but it does not have to. If it is closed early then the kernel object will be freed when no handles remain, which will be at process exit.

So it's a classic __exit__/__del__ case, where both are needed if you want deterministic resource disposal. But it is in no way tied to the life of the child process, so waiting first is optional.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37380>
_______________________________________


More information about the Python-bugs-list mailing list