#2959: allow multiple close() calls for GzipFile.

This commit is contained in:
Georg Brandl 2008-05-25 08:07:37 +00:00
parent ecd0ad3c57
commit e08e3d0686
3 changed files with 12 additions and 3 deletions

View file

@ -306,6 +306,8 @@ class GzipFile:
raise IOError, "Incorrect length of data produced"
def close(self):
if self.fileobj is None:
return
if self.mode == WRITE:
self.fileobj.write(self.compress.flush())
write32u(self.fileobj, self.crc)