]> granicus.if.org Git - python/commitdiff
Don't seek to the start of the file when open ZipFile with the 'w' mode
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 1 Feb 2015 17:01:10 +0000 (19:01 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 1 Feb 2015 17:01:10 +0000 (19:01 +0200)
(regression introduced in issue #14099).

Lib/zipfile.py

index 845c6a96fc61bef97c28c274522303f560933122..8c2950f5333129d69f0d25bc78ea21bac668afaa 100644 (file)
@@ -1002,7 +1002,7 @@ class ZipFile:
                 # 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