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/iobase.c b/Modules/_io/iobase.c
index ba86146..8b17ecd 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -674,7 +674,10 @@
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);