mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Fix for #1415 pythonw.exe fails because std streams a missing
After a long discussion about the problem with Windows GUI apps Guido decided that sys.stdin, stdout and stderr should be None when the C runtime library returns invalid file descriptors for the standard streams. So far the only known cases are Windows GUI apps and scripts started with pythonw on Windows. The OS restrictions are tight enough to catch the problem on other OSes.
This commit is contained in:
parent
f05149a257
commit
58cb1b8b0e
4 changed files with 63 additions and 13 deletions
|
@ -363,7 +363,7 @@ PyFile_NewStdPrinter(int fd)
|
|||
{
|
||||
PyStdPrinter_Object *self;
|
||||
|
||||
if ((fd != fileno(stdout) && fd != fileno(stderr)) || fd < 0) {
|
||||
if (fd != fileno(stdout) && fd != fileno(stderr)) {
|
||||
/* not enough infrastructure for PyErr_BadInternalCall() */
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue