summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2015-03-19 23:10:23 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2015-03-19 23:10:23 (GMT)
commit484b9f3b9983e3c05f1d84ce9581fe95b0bf84b9 (patch)
tree05d0aa9100e7f7471c408ac3df0ae71ae7002fba /Objects
parent31084ba52856329b972b84299b438bf5b73be292 (diff)
parentc1cf4f7ef9e6b295d397bdecbc1a2f9f8f529a14 (diff)
downloadcpython-484b9f3b9983e3c05f1d84ce9581fe95b0bf84b9.zip
cpython-484b9f3b9983e3c05f1d84ce9581fe95b0bf84b9.tar.gz
cpython-484b9f3b9983e3c05f1d84ce9581fe95b0bf84b9.tar.bz2
Merge
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 596f909..6f2e351 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -383,26 +383,15 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
Py_RETURN_NONE;
}
- if (!PyArg_ParseTuple(args, "s", &c)) {
+ if (!PyArg_ParseTuple(args, "s", &c))
return NULL;
- }
- n = strlen(c);
- Py_BEGIN_ALLOW_THREADS
- errno = 0;
-#ifdef MS_WINDOWS
- if (n > INT_MAX)
- n = INT_MAX;
- n = write(self->fd, c, (int)n);
-#else
- n = write(self->fd, c, n);
-#endif
- Py_END_ALLOW_THREADS
-
- if (n < 0) {
- if (errno == EAGAIN)
+ n = _Py_write(self->fd, c, strlen(c));
+ if (n == -1) {
+ if (errno == EAGAIN) {
+ PyErr_Clear();
Py_RETURN_NONE;
- PyErr_SetFromErrno(PyExc_IOError);
+ }
return NULL;
}