2014-05-19 19:48:35 +02:00
|
|
|
http://bugs.python.org/issue17797
|
|
|
|
http://connect.microsoft.com/VisualStudio/feedback/details/785119/
|
|
|
|
|
2015-07-26 21:38:38 +02:00
|
|
|
Visual Studio 2013 changed return value for fileno function that breaks
|
2014-05-19 19:48:35 +02:00
|
|
|
when python tries to check/setup stdin/out/err
|
2014-05-24 23:50:36 +02:00
|
|
|
GetStdHandle on Windows XP behaves contrary to the documentation...
|
2015-07-26 21:38:38 +02:00
|
|
|
MSVC 14.0 fixed this bug.
|
2015-05-06 22:28:05 +02:00
|
|
|
|
2015-07-26 21:38:38 +02:00
|
|
|
diff -ru python3.orig/Python/pylifecycle.c python3/Python/pylifecycle.c
|
|
|
|
--- python3.orig/Python/pylifecycle.c 2015-07-05 18:50:08.000000000 +0200
|
|
|
|
+++ python3/Python/pylifecycle.c 2015-07-26 20:01:23.563082638 +0200
|
|
|
|
@@ -1065,15 +1065,30 @@
|
2015-05-06 22:28:05 +02:00
|
|
|
static int
|
|
|
|
is_valid_fd(int fd)
|
|
|
|
{
|
|
|
|
- int dummy_fd;
|
|
|
|
if (fd < 0 || !_PyVerify_fd(fd))
|
|
|
|
return 0;
|
2015-07-26 21:38:38 +02:00
|
|
|
- _Py_BEGIN_SUPPRESS_IPH
|
2015-05-06 22:28:05 +02:00
|
|
|
- dummy_fd = dup(fd);
|
2015-07-26 21:38:38 +02:00
|
|
|
- if (dummy_fd >= 0)
|
|
|
|
- close(dummy_fd);
|
|
|
|
- _Py_END_SUPPRESS_IPH
|
|
|
|
- return dummy_fd >= 0;
|
2014-05-24 23:50:36 +02:00
|
|
|
+
|
2015-07-26 21:38:38 +02:00
|
|
|
+#if defined(MS_WINDOWS) && defined(HAVE_FSTAT) && defined(_MSC_VER) && (_MSC_VER >= 1700 && _MSC_VER < 1900)
|
2015-05-06 22:28:05 +02:00
|
|
|
+ /* dup (DuplicateHandle) doesn't say fd is a valid *file* handle.
|
|
|
|
+ * It could be a current thread pseudo-handle.
|
|
|
|
+ */
|
|
|
|
+ {
|
|
|
|
+ struct stat buf;
|
|
|
|
+ if (fstat(fd, &buf) < 0 && (errno == EBADF || errno == ENOENT))
|
|
|
|
+ return 0;
|
2015-07-26 21:38:38 +02:00
|
|
|
+ else
|
|
|
|
+ return 1;
|
2015-05-06 22:28:05 +02:00
|
|
|
+ }
|
2014-05-19 19:48:35 +02:00
|
|
|
+#else
|
2015-05-06 22:28:05 +02:00
|
|
|
+ {
|
2015-07-26 21:38:38 +02:00
|
|
|
+ int dummy_fd = dup(fd);
|
|
|
|
+ _Py_BEGIN_SUPPRESS_IPH
|
|
|
|
+ if (dummy_fd >= 0)
|
|
|
|
+ close(dummy_fd);
|
|
|
|
+ _Py_END_SUPPRESS_IPH
|
|
|
|
+ return dummy_fd >= 0;
|
2015-05-06 22:28:05 +02:00
|
|
|
+ }
|
2014-05-19 19:48:35 +02:00
|
|
|
+#endif
|
2015-05-06 22:28:05 +02:00
|
|
|
}
|
2014-05-19 19:48:35 +02:00
|
|
|
|
2015-07-26 21:38:38 +02:00
|
|
|
/* Initialize sys.stdin, stdout, stderr and builtins.open */
|