[issue3210] subprocess.Popen does not release process handles if process cannot be started

Tim Golden report at bugs.python.org
Thu Jun 26 19:26:03 CEST 2008


Tim Golden <mail at timgolden.me.uk> added the comment:

The attached file sp-3.py simulates what I think is happening within the
subprocess module. Note that the OS handle is duplicated to allow
inheritance and then left unclosed on failure. If it is explicitly
closed, the file can be removed.

There is no hope of closing the file handle since it was local to the
__init__ method which failed but was not closed before exit and is now
inaccessible.

On the surface, the obvious fix would be a try/except block around the
CreateProcess call (or its caller) which would then release whatever
handles were needed. I'll try to get the time to put a patch together,
but it would be useful to have confirmation of my theory.

----------
nosy: +tim.golden
Added file: http://bugs.python.org/file10744/sp-3.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3210>
_______________________________________


More information about the Python-bugs-list mailing list