[issue16140] subprocess.Popen the os.close calls in _execute_child can raise an EBADF exception
Benno Leslie
report at bugs.python.org
Fri Oct 5 14:28:15 CEST 2012
Benno Leslie added the comment:
Regarding #2 my understanding is that the FDs are already always wrapped.
E.g: at line http://hg.python.org/cpython/file/b9ac3c44a4eb/Lib/subprocess.py#l798 it shows these always being wrapped (assuming the file descriptor is not -1).
For my test case on 3.2.3, replacing the os.close loop with:
if p2cwrite != -1:
self.stdin.close()
if c2pread != -1:
self.stdout.close()
if errread != -1:
self.stderr.close()
This fixed all my stability problems and races, and can't (as far as I can tell) cause any other problems; however this is a very subtle module, so I'm eager to understand if this would cause any undesirable side-effects.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16140>
_______________________________________
More information about the Python-bugs-list
mailing list