summaryrefslogtreecommitdiffstats
path: root/Modules/_io/fileio.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-06-24 06:55:39 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-06-24 06:55:39 (GMT)
commit5135992164f4c0df8d18d3b486431b28214db16b (patch)
tree7bc3060d22ad740bf2bf795caae1c6a46232f6e7 /Modules/_io/fileio.c
parent8150492f11f17e2a09f7deb7af706536bc326c98 (diff)
downloadcpython-5135992164f4c0df8d18d3b486431b28214db16b.zip
cpython-5135992164f4c0df8d18d3b486431b28214db16b.tar.gz
cpython-5135992164f4c0df8d18d3b486431b28214db16b.tar.bz2
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.
Diffstat (limited to 'Modules/_io/fileio.c')
-rw-r--r--Modules/_io/fileio.c7
1 files changed, 7 insertions, 0 deletions
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 @@ fileio_readall(fileio *self)
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) {