diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-30 13:03:50 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-30 13:03:50 (GMT) |
commit | d69dd8bd5e81b94b326aeb6fc4d33fb57395d840 (patch) | |
tree | 2238be9160fe396deaccc2157b15fcdffc446b73 | |
parent | 85c386dee4dc9ca0508553f2d64bf4d10086e558 (diff) | |
parent | ae86da9b204b0fe2510309bd9fae688e7c9a35fb (diff) | |
download | cpython-d69dd8bd5e81b94b326aeb6fc4d33fb57395d840.zip cpython-d69dd8bd5e81b94b326aeb6fc4d33fb57395d840.tar.gz cpython-d69dd8bd5e81b94b326aeb6fc4d33fb57395d840.tar.bz2 |
(Merge 3.5) Issue #25182: Fix compilation on Windows
-rw-r--r-- | Objects/fileobject.c | 9 |
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; } |