Index: zipfile.py =================================================================== --- zipfile.py (revision 74191) +++ zipfile.py (working copy) @@ -718,6 +718,12 @@ self.fp = None raise RuntimeError, 'Mode must be "r", "w" or "a"' + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + self.close() + def _GetContents(self): """Read the directory, making sure we close the file if the format is bad."""