summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index b7de6a1..2647b54 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -1849,6 +1849,11 @@ file_writelines(PyFileObject *f, PyObject *seq)
}
PyList_SetItem(list, j, line);
}
+ /* The iterator might have closed the file on us. */
+ if (f->f_fp == NULL) {
+ err_closed();
+ goto error;
+ }
}
if (j == 0)
break;