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

Alain Kalker report at bugs.python.org
Fri Sep 3 19:36:31 CEST 2010


New submission from Alain Kalker <miki at dds.nl>:

>>> f = open("test2.gz")
>>> d = f.read()
>>> f.close()
>>> e = f.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file
import gzip
>>> f = gzip.open("test2.gz")
>>> d = f.read()
>>> f.close()
>>> e = f.read()
>>> e
''

To remain consistent with other file(-like) objects, I think 'GzipFile's should also raise a ValueError in cases like this.

----------
components: Library (Lib)
messages: 115473
nosy: ack
priority: normal
severity: normal
status: open
title: GzipFile object should raise ValueError on .read() after .close()
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9759>
_______________________________________


More information about the Python-bugs-list mailing list