New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: subprocess debug assertion on failure to execute the process #74307
Comments
subprocess triggers a debug assertion in the CRT on failure to execute the process due to closing the pipe *handles* in the except clause using os.close rather than .Close() (os.close closes CRT file descriptors and not handles). In addition to that once this is fixed there is also a double free/close since we need to set To reproduce, do this in a debug build of Python: import subprocess
subprocess.Popen('exe_that_doesnt_exist.exe', stdout=subprocess.PIPE) See: #1218 (comment) |
I determined in bpo-31228 (also on Windows, closed as a duplicate) that a debug build, bad file, and subprocess.PIPE are all required. Has this been tried on non-Windows? I confirmed the crash on 3.6. I do not have a 2.7 repository build. The two lines above constitute a unittest that currently fails on a Windows debug build. Even if there is no such buildbot, I think a test should be added that will fail on developer machines with such builds. It should be skipped on non-debug and perhaps non-Windows machines. |
Python 2.7 doesn't seem to be affected by this issue. Extract of Popen.__init__:
for fd in to_close:
try:
if mswindows:
fd.Close()
else:
os.close(fd)
except EnvironmentError:
pass On Windows, fd.Close() is always used. |
Oops, I merged the pull requests, but I forgot to close the issue. |
Oops, I forgot to close the issue, again... Thanks Segev for closing it, finally :-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: