[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program
Mateusz Loskot
report at bugs.python.org
Fri Apr 19 14:32:45 CEST 2013
Mateusz Loskot added the comment:
Yes, it does. In file Modulfileio.c, in function fileio_init, there is this code:
if (fd >= 0) {
if (check_fd(fd))
goto error;
self->fd = fd;
self->closefd = closefd;
}
The check_fd tests:
if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) {
The _PyVerify_fd(fd) == 1, but errno is "Bad file descriptor".
This eventually leads to Py_InitializeEx failure at:
if (initstdio() < 0)
Py_FatalError(
"Py_Initialize: can't initialize sys standard streams");
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17797>
_______________________________________
More information about the Python-bugs-list
mailing list