Browse Source

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.
pull/2/head
Serhiy Storchaka 10 years ago
parent
commit
67e1aa0b58
  1. 5
      Lib/zipfile.py
  2. 3
      Misc/NEWS

5
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()

3
Misc/NEWS

@ -208,6 +208,9 @@ Core and Builtins
Library
-------
- 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.
- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows
- Issue #13051: Fixed recursion errors in large or resized

Loading…
Cancel
Save