New submission from Michael Magin <[EMAIL PROTECTED]>: 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. ---------- components: Library (Lib) files: gzip.py.patch keywords: patch messages: 67313 nosy: mmagin severity: normal status: open title: calling GzipFile close() more than once causes exception versions: Python 2.4, Python 2.5 Added file: http://bugs.python.org/file10431/gzip.py.patch __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2959> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com