summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 403d718..a836cb3 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -402,23 +402,14 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
}
}
- Py_BEGIN_ALLOW_THREADS
- errno = 0;
-#ifdef MS_WINDOWS
- if (n > INT_MAX)
- n = INT_MAX;
- n = write(self->fd, str, (int)n);
-#else
- n = write(self->fd, str, n);
-#endif
+ n = _Py_write(self->fd, str, n);
_errno = errno;
- Py_END_ALLOW_THREADS
Py_XDECREF(bytes);
-
- if (n < 0) {
- if (_errno == EAGAIN)
+ if (n == -1) {
+ if (_errno == EAGAIN) {
+ PyErr_Clear();
Py_RETURN_NONE;
- PyErr_SetFromErrno(PyExc_IOError);
+ }
return NULL;
}