[Python-checkins] cpython (merge 3.5 -> default): (Merge 3.5) Issue #25182: Fix compilation on Windows

victor.stinner python-checkins at python.org
Wed Sep 30 15:04:25 CEST 2015


https://hg.python.org/cpython/rev/d1090d733d39
changeset:   98440:d1090d733d39
parent:      98437:0b0945c8de36
parent:      98439:0eb26a4d5ffa
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Sep 30 15:03:50 2015 +0200
summary:
  (Merge 3.5) Issue #25182: Fix compilation on Windows

files:
  Objects/fileobject.c |  9 ++++++---
  1 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/Objects/fileobject.c b/Objects/fileobject.c
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -376,7 +376,7 @@
     PyObject *bytes = NULL;
     char *str;
     Py_ssize_t n;
-    int _errno;
+    int err;
 
     if (self->fd < 0) {
         /* fd might be invalid on Windows
@@ -403,10 +403,13 @@
     }
 
     n = _Py_write(self->fd, str, n);
-    _errno = errno;
+    /* save errno, it can be modified indirectly by Py_XDECREF() */
+    err = errno;
+
     Py_XDECREF(bytes);
+
     if (n == -1) {
-        if (_errno == EAGAIN) {
+        if (err == EAGAIN) {
             PyErr_Clear();
             Py_RETURN_NONE;
         }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list