Commit d15f8bbe authored by Tim Peters's avatar Tim Peters

SF bug 486480: zipfile __del__ is broken

ZipFile.__del__():  call ZipFile.close(), like its docstring says it does.
ZipFile.close():  allow calling more than once (as all file-like objects
in Python should support).
parent 97019e41
......@@ -454,13 +454,13 @@ class ZipFile:
def __del__(self):
"""Call the "close()" method in case the user forgot."""
if self.fp and not self._filePassed:
self.fp.close()
self.fp = None
self.close()
def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
if self.mode in ("w", "a"): # write ending records
count = 0
pos1 = self.fp.tell()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment