summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-01-01 19:07:13 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-01-01 19:07:13 (GMT)
commit649b75954a1880e8a6dc15066a3041bfabac959a (patch)
tree33eb8a29a81dfa31e48ba8966df71cee1de8345f /Objects
parenta6e975801e37bef27deb3207f6fc8f0c59affb46 (diff)
downloadcpython-649b75954a1880e8a6dc15066a3041bfabac959a.zip
cpython-649b75954a1880e8a6dc15066a3041bfabac959a.tar.gz
cpython-649b75954a1880e8a6dc15066a3041bfabac959a.tar.bz2
SF Patch #494863, file.xreadlines() should raise ValueError if file is closed
This makes xreadlines behave like all other file methods (other than close() which just returns).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 27612f4..9af5ca9 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -1025,6 +1025,8 @@ file_xreadlines(PyFileObject *f)
{
static PyObject* xreadlines_function = NULL;
+ if (f->f_fp == NULL)
+ return err_closed();
if (!xreadlines_function) {
PyObject *xreadlines_module =
PyImport_ImportModule("xreadlines");