summaryrefslogtreecommitdiff
path: root/external/python3/python-3.3.3-py17797.patch.1
blob: 3c43fb120713c2025998da0a9880777cefce291a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
http://bugs.python.org/issue17797
http://connect.microsoft.com/VisualStudio/feedback/details/785119/

Visual Studio 2012 changed return value for fileno function that breaks
when python tries to check/setup stdin/out/err
diff -ur python3.org/Python/pythonrun.c python3/Python/pythonrun.c
--- python3.org/Python/pythonrun.c	2014-05-19 19:06:01.305362400 +0200
+++ python3/Python/pythonrun.c	2014-05-19 19:07:13.649079800 +0200
@@ -1083,7 +1083,11 @@
      * and fileno() may point to an invalid file descriptor. For example
      * GUI apps don't have valid standard streams by default.
      */
+#ifdef MS_WINDOWS
+    if (!is_valid_fd(fd) || GetStdHandle(STD_INPUT_HANDLE) == NULL) {
+#else
     if (!is_valid_fd(fd)) {
+#endif
         std = Py_None;
         Py_INCREF(std);
     }
@@ -1098,7 +1102,11 @@
 
     /* Set sys.stdout */
     fd = fileno(stdout);
+#ifdef MS_WINDOWS
+    if (!is_valid_fd(fd) || GetStdHandle(STD_OUTPUT_HANDLE) == NULL) {
+#else
     if (!is_valid_fd(fd)) {
+#endif
         std = Py_None;
         Py_INCREF(std);
     }
@@ -1114,7 +1122,11 @@
 #if 1 /* Disable this if you have trouble debugging bootstrap stuff */
     /* Set sys.stderr, replaces the preliminary stderr */
     fd = fileno(stderr);
+#ifdef MS_WINDOWS
+    if (!is_valid_fd(fd) || GetStdHandle(STD_ERROR_HANDLE) == NULL) {
+#else
     if (!is_valid_fd(fd)) {
+#endif
         std = Py_None;
         Py_INCREF(std);
     }