summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index e01c4398d6..946d41c22a 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -847,6 +847,12 @@ get_line(PyFileObject *f, int n)
if (c == '\n')
break;
if (c == EOF) {
+ if (ferror(fp)) {
+ PyErr_SetFromErrno(PyExc_IOError);
+ clearerr(fp);
+ Py_DECREF(v);
+ return NULL;
+ }
clearerr(fp);
if (PyErr_CheckSignals()) {
Py_DECREF(v);