Fixes issue #12268: File readline, readlines and read() or readall() methods
no longer lose data when an underlying read system call is interrupted.
IOError is no longer raised due to a read system call returning EINTR
from within these methods.
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 6feca21..a7fad36 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -605,6 +605,13 @@
if (n == 0)
break;
if (n < 0) {
+ if (errno == EINTR) {
+ if (PyErr_CheckSignals()) {
+ Py_DECREF(result);
+ return NULL;
+ }
+ continue;
+ }
if (total > 0)
break;
if (errno == EAGAIN) {