Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 008fc77 + 89719e1 commit ae86da9Copy full SHA for ae86da9
1 file changed
Objects/fileobject.c
@@ -376,7 +376,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
376
PyObject *bytes = NULL;
377
char *str;
378
Py_ssize_t n;
379
- int _errno;
+ int err;
380
381
if (self->fd < 0) {
382
/* fd might be invalid on Windows
@@ -403,10 +403,13 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
403
}
404
405
n = _Py_write(self->fd, str, n);
406
- _errno = errno;
+ /* save errno, it can be modified indirectly by Py_XDECREF() */
407
+ err = errno;
408
+
409
Py_XDECREF(bytes);
410
411
if (n == -1) {
- if (_errno == EAGAIN) {
412
+ if (err == EAGAIN) {
413
PyErr_Clear();
414
Py_RETURN_NONE;
415
0 commit comments