Additional fix for Issue #12268: The io module file object writelines() methods
no longer abort early when one of its write system calls is interrupted (EINTR).
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index d2e92fa..c9913d4 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1213,8 +1213,11 @@
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;