[issue9759] GzipFile object should raise ValueError on .read() after .close()

Jeffrey Finkelstein report at bugs.python.org
Tue Sep 14 05:34:17 CEST 2010

Jeffrey Finkelstein <jeffrey.finkelstein at gmail.com> added the comment:

Here is a patch for the py3k branch which adds a check for whether the GzipFile is closed on each call to GzipFile.read(). If the file is closed already, the method raises a ValueError if it is (with the message text copied from the corresponding fileobject's error message). I added an assertion to the test_read() method in Lib/test/test_gzip.py.

The changes will be exactly the same for the 2.7 branch.

keywords: +patch
nosy: +jfinkels
Added file: http://bugs.python.org/file18874/issue9759.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list