summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-30 13:03:31 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-09-30 13:03:31 (GMT)
commitae86da9b204b0fe2510309bd9fae688e7c9a35fb (patch)
tree3ee9cbd8cdf8ee3107f5777e28f9fa62ef8eb555 /Objects
parent008fc77e1e443e799be19aebb697b7daf335a0c7 (diff)
parent89719e1daf8b15810145baf56d984ecbc1bab7ef (diff)
downloadcpython-ae86da9b204b0fe2510309bd9fae688e7c9a35fb.zip
cpython-ae86da9b204b0fe2510309bd9fae688e7c9a35fb.tar.gz
cpython-ae86da9b204b0fe2510309bd9fae688e7c9a35fb.tar.bz2
(Merge 3.4) Issue #25182: Fix compilation on Windows
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index a836cb3..234d07e 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -376,7 +376,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
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 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
}
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;
}