diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-01 23:43:02 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-01 23:43:02 (GMT) |
commit | 67e1aa0b58be7164415277d5929cd7fa8fc94001 (patch) | |
tree | c7f2dd58d40fa00ba6f098bb7d864e029ba97434 /Lib/zipfile.py | |
parent | 06c0dca5a65b7bd8741e3806b1f7a1bcb48e1348 (diff) | |
parent | e465a9af8e87aa2c4c20dfaa23b310827c2ec345 (diff) | |
download | cpython-67e1aa0b58be7164415277d5929cd7fa8fc94001.zip cpython-67e1aa0b58be7164415277d5929cd7fa8fc94001.tar.gz cpython-67e1aa0b58be7164415277d5929cd7fa8fc94001.tar.bz2 |
Issue #29094: Offsets in a ZIP file created with extern file object and modes
"w" and "x" now are relative to the start of the file.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index e31c93a..9317135 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1101,11 +1101,12 @@ 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_disk = 0 try: - self.start_dir = self._start_disk = self.fp.tell() + self.start_dir = self.fp.tell() except (AttributeError, OSError): self.fp = _Tellable(self.fp) - self.start_dir = self._start_disk = 0 + self.start_dir = 0 self._seekable = False else: # Some file-like objects can provide tell() but not seek() |