summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS6
-rw-r--r--Modules/_io/iobase.c5
-rw-r--r--Modules/_io/textio.c7
3 files changed, 15 insertions, 3 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 29c5ad6..7f39eed 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -715,6 +715,12 @@ Library
`sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common
code was moved from _hashopenssl.c to hashlib.h.
+Extension Modules
+-----------------
+
+- Issue #12268: The io module file object write methods no longer abort early
+ when one of its write system calls is interrupted (EINTR).
+
Tests
-----
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index babb019..2039147 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -669,7 +669,10 @@ iobase_writelines(PyObject *self, PyObject *args)
break; /* Stop Iteration */
}
- res = PyObject_CallMethodObjArgs(self, _PyIO_str_write, line, NULL);
+ res = NULL;
+ do {
+ res = PyObject_CallMethodObjArgs(self, _PyIO_str_write, line, NULL);
+ } while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(line);
if (res == NULL) {
Py_DECREF(iter);
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index afd8d41..9da4cd2 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1247,8 +1247,11 @@ _textiowrapper_writeflush(textio *self)
Py_DECREF(pending);
if (b == NULL)
return -1;
- ret = PyObject_CallMethodObjArgs(self->buffer,
- _PyIO_str_write, b, NULL);
+ ret = NULL;
+ do {
+ ret = PyObject_CallMethodObjArgs(self->buffer,
+ _PyIO_str_write, b, NULL);
+ } while (ret == NULL && _PyIO_trap_eintr());
Py_DECREF(b);
if (ret == NULL)
return -1;