1 http://bugs.python.org/issue17797
2 http://connect.microsoft.com/VisualStudio/feedback/details/785119/
4 Visual Studio 2012 changed return value for fileno function that breaks
5 when python tries to check/setup stdin/out/err
6 GetStdHandle on Windows XP behaves contrary to the documentation...
8 diff --git a/Python/pythonrun.c b/Python/pythonrun.c
9 index 91d56b7..d28ffc7 100644
10 --- a/Python/pythonrun.c
11 +++ b/Python/pythonrun.c
12 @@ -1015,13 +1015,28 @@ error:
17 if (fd < 0 || !_PyVerify_fd(fd))
24 +#if defined(MS_WINDOWS) && defined(HAVE_FSTAT)
25 + /* dup (DuplicateHandle) doesn't say fd is a valid *file* handle.
26 + * It could be a current thread pseudo-handle.
30 + if (fstat(fd, &buf) < 0 && (errno == EBADF || errno == ENOENT))