[issue3860] GzipFile and BZ2File should support context manager protocol
report at bugs.python.org
Sat Dec 27 01:46:10 CET 2008
Antoine Pitrou <pitrou at free.fr> added the comment:
> (1) the IOError message is different for the two modules:
> "I/O operation on closed GzipFile object"
> "I/O operation on closed file"
I've reused the same error message as used in other parts of each
> (2) For bz2module, Why don't you call BZ2File_close() directly instead
> of the generic version PyObject_CallMethod(... "close" ...)?
Because someone may subclass BZ2File and override the close() method. I
don't know if it's likely to happen, though.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list