Antoine Pitrou pit...@free.fr added the comment:
Patch committed in r85291 (3.x), and backported to 3.1 (r85293) and 2.7
(r85292). Thank you!
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker
Antoine Pitrou pit...@free.fr added the comment:
You should make sure that all operations (except close() itself) raise
ValueError. Currently:
f = gzip.open(test.gz, rb)
f.close()
f.read()
b''
f.seek(0)
0
Also, you don't have to post a patch for 2.7. We'll do the porting ourselves.
Thanks
Jeffrey Finkelstein jeffrey.finkelst...@gmail.com added the comment:
Here's the updated patch, which checks whether the file is closed on each call
to read(), write(), and flush(), along with a test.
--
Added file: http://bugs.python.org/file18893/issue9759.patch
Changes by Antoine Pitrou pit...@free.fr:
--
versions: +Python 2.7, Python 3.1
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9759
___
___
Éric Araujo mer...@netwok.org added the comment:
Should this be fixed in 3.1 and 2.7 too?
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9759
___
Changes by R. David Murray rdmur...@bitdance.com:
--
keywords: +easy
nosy: +pitrou
versions: +Python 3.2
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9759
___
New submission from Alain Kalker m...@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
''
Changes by Amaury Forgeot d'Arc amaur...@gmail.com:
--
stage: - needs patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9759
___
___