Mercurial > cpython-lru_cache-weakref
diff Objects/fileobject.c @ 21607:be213f1cd462 legacy-trunk
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).
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Tue, 01 Jan 2002 19:07:13 +0000 |
| parents | ed3dce17fc79 |
| children | c64fc56f6072 |
line wrap: on
line diff
--- a/Objects/fileobject.c Tue Jan 01 18:41:33 2002 +0000 +++ b/Objects/fileobject.c Tue Jan 01 19:07:13 2002 +0000 @@ -1025,6 +1025,8 @@ { static PyObject* xreadlines_function = NULL; + if (f->f_fp == NULL) + return err_closed(); if (!xreadlines_function) { PyObject *xreadlines_module = PyImport_ImportModule("xreadlines");
