diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-01 17:05:29 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-01 17:05:29 (GMT) |
commit | e465a9af8e87aa2c4c20dfaa23b310827c2ec345 (patch) | |
tree | 102effb7bae6bdd6b547eb7d9b1d9dc292146b3d /Lib/zipfile.py | |
parent | 75d9016530369999e099a247f260f76f544dc20d (diff) | |
parent | 34cba334034ddef3b32e47bf94cb7d224cfaf15d (diff) | |
download | cpython-e465a9af8e87aa2c4c20dfaa23b310827c2ec345.zip cpython-e465a9af8e87aa2c4c20dfaa23b310827c2ec345.tar.gz cpython-e465a9af8e87aa2c4c20dfaa23b310827c2ec345.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 e2ae042..7f2b43c 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1102,11 +1102,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() |