[issue3860] GzipFile and BZ2File should support context manager protocol
STINNER Victor
report at bugs.python.org
Sat Dec 27 00:45:14 CET 2008
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
I love "with ... as f:" and I want it for gzip/bz2 files!
Comment about the patch:
(1) the IOError message is different for the two modules:
"I/O operation on closed GzipFile object"
vs
"I/O operation on closed file"
Specify the object name in both messages or remove it from both
messages. I prefer verbose error message ("I/O operation on closed
BZ2File object").
(2) For bz2module, Why don't you call BZ2File_close() directly instead
of the generic version PyObject_CallMethod(... "close" ...)?
----------
nosy: +haypo
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3860>
_______________________________________
More information about the Python-bugs-list
mailing list