diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-30 13:03:31 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-30 13:03:31 (GMT) |
commit | ae86da9b204b0fe2510309bd9fae688e7c9a35fb (patch) | |
tree | 3ee9cbd8cdf8ee3107f5777e28f9fa62ef8eb555 /Objects/fileobject.c | |
parent | 008fc77e1e443e799be19aebb697b7daf335a0c7 (diff) | |
parent | 89719e1daf8b15810145baf56d984ecbc1bab7ef (diff) | |
download | cpython-ae86da9b204b0fe2510309bd9fae688e7c9a35fb.zip cpython-ae86da9b204b0fe2510309bd9fae688e7c9a35fb.tar.gz cpython-ae86da9b204b0fe2510309bd9fae688e7c9a35fb.tar.bz2 |
(Merge 3.4) Issue #25182: Fix compilation on Windows
Diffstat (limited to 'Objects/fileobject.c')
-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; } |