diff --git a/Lib/zipfile.py b/Lib/zipfile.py index c3f814cc747e06..af42fd8df21486 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1919,6 +1919,7 @@ def _write_end_record(self): centDirSize, centDirOffset, len(self._comment)) self.fp.write(endrec) self.fp.write(self._comment) + self.fp.truncate() self.fp.flush() def _fpclose(self, fp):