Commit a5c631e7 authored by Victor Stinner's avatar Victor Stinner

(Merge 3.4) Issue #25182: Fix compilation on Windows

parents ad794f89 e1b99f9e
...@@ -376,7 +376,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args) ...@@ -376,7 +376,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
PyObject *bytes = NULL; PyObject *bytes = NULL;
char *str; char *str;
Py_ssize_t n; Py_ssize_t n;
int _errno; int err;
if (self->fd < 0) { if (self->fd < 0) {
/* fd might be invalid on Windows /* fd might be invalid on Windows
...@@ -403,10 +403,13 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args) ...@@ -403,10 +403,13 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
} }
n = _Py_write(self->fd, str, n); n = _Py_write(self->fd, str, n);
_errno = errno; /* save errno, it can be modified indirectly by Py_XDECREF() */
err = errno;
Py_XDECREF(bytes); Py_XDECREF(bytes);
if (n == -1) { if (n == -1) {
if (_errno == EAGAIN) { if (err == EAGAIN) {
PyErr_Clear(); PyErr_Clear();
Py_RETURN_NONE; Py_RETURN_NONE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment