This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mmagin
Recipients mmagin
Date 2008-05-24.23:25:41
SpamBayes Score 0.0023094567
Marked as misclassified No
Message-id <1211671572.76.0.880996454775.issue2959@psf.upfronthosting.co.za>
In-reply-to
Content
Built-in file objects allow repeated calls to .close(), even the
documentation states, "Calling close() more than once is allowed."
(http://docs.python.org/lib/bltin-file-objects.html)

GzipFile does not obey this aspect of the file interface:
>>> import gzip
>>> f = gzip.GzipFile('testfile1.gz', 'ab')
>>> f.close()
>>> f.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/gzip.py",
line 315, in close
    self.fileobj.write(self.compress.flush())
AttributeError: 'NoneType' object has no attribute 'write'

The gzip documentation does not document this (mis-)behavior.

(Trivial) patch against 2.4.3 gzip.py attached.
History
Date User Action Args
2008-05-24 23:26:22mmaginsetspambayes_score: 0.00230946 -> 0.0023094567
recipients: + mmagin
2008-05-24 23:26:13mmaginsetspambayes_score: 0.00230946 -> 0.00230946
messageid: <1211671572.76.0.880996454775.issue2959@psf.upfronthosting.co.za>
2008-05-24 23:26:10mmaginlinkissue2959 messages
2008-05-24 23:26:07mmagincreate