Message187351
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. |
|
Date |
User |
Action |
Args |
2013-04-19 12:18:32 | mloskot | set | recipients:
+ mloskot |
2013-04-19 12:18:32 | mloskot | set | messageid: <1366373912.56.0.138468709297.issue17797@psf.upfronthosting.co.za> |
2013-04-19 12:18:32 | mloskot | link | issue17797 messages |
2013-04-19 12:18:32 | mloskot | create | |
|