[Python-checkins] cpython: Don't seek to the start of the file when open ZipFile with the 'w' mode

serhiy.storchaka python-checkins at python.org
Sun Feb 1 18:06:35 CET 2015


https://hg.python.org/cpython/rev/4f96e9a8eee8
changeset:   94427:4f96e9a8eee8
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Feb 01 19:01:10 2015 +0200
summary:
  Don't seek to the start of the file when open ZipFile with the 'w' mode
(regression introduced in issue #14099).

files:
  Lib/zipfile.py |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Lib/zipfile.py b/Lib/zipfile.py
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1002,7 +1002,7 @@
                 # set the modified flag so central directory gets written
                 # even if no files are added to the archive
                 self._didModify = True
-                self.start_dir = 0
+                self.start_dir = self.fp.tell()
             elif mode == 'a':
                 try:
                     # See if file is a zip file

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list