New submission from Mateusz Loskot: In pythonrun.c, there is function initstdio() with the following test:
static int initstdio(void) { ... /* Set sys.stdin */ fd = fileno(stdin); /* Under some conditions stdin, stdout and stderr may not be connected * and fileno() may point to an invalid file descriptor. For example * GUI apps don't have valid standard streams by default. */ if (fd < 0) { #ifdef MS_WINDOWS std = Py_None; Py_INCREF(std); #else goto error; #endif } else { ... } This function is fails for non-console applications (i.e. MFC) built using Visual C++ 11.0 (Visual Studio 2012), becasue **strangely**, fileno(stdin) == 0, so this test results in false and Python initialisation routines attempt to setup streams. Apparently, fileno(stdin) return value has changed between Visual C++ 10.0 (VS 2010) and 11.0. The VC++ 10.0 reports fileno(stdin) == -2. ---------- components: IO, Interpreter Core messages: 187351 nosy: mloskot priority: normal severity: normal status: open title: Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17797> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com