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

Emanuel Zephir report at bugs.python.org
Sun Jul 21 04:07:31 EDT 2019


Emanuel Zephir <emanuelzephir at gmail.com> added the comment:

I believe this to be a bug in the standard library instead of solely being the result of an application error.

When a Popen instance is finalized by the garbage collector, the internal handle is also finalized and closed despite the instance being put on the active list. This results in _cleanup throwing because the handle can no longer be used.

I've attached a small reproduction.

----------
nosy: +emanuel
Added file: https://bugs.python.org/file48493/invalid_handle.py

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


More information about the Python-bugs-list mailing list