Kaydet (Commit) e465a9af authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

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.
...@@ -1102,11 +1102,12 @@ class ZipFile: ...@@ -1102,11 +1102,12 @@ class ZipFile:
# set the modified flag so central directory gets written # set the modified flag so central directory gets written
# even if no files are added to the archive # even if no files are added to the archive
self._didModify = True self._didModify = True
self._start_disk = 0
try: try:
self.start_dir = self._start_disk = self.fp.tell() self.start_dir = self.fp.tell()
except (AttributeError, OSError): except (AttributeError, OSError):
self.fp = _Tellable(self.fp) self.fp = _Tellable(self.fp)
self.start_dir = self._start_disk = 0 self.start_dir = 0
self._seekable = False self._seekable = False
else: else:
# Some file-like objects can provide tell() but not seek() # Some file-like objects can provide tell() but not seek()
......
...@@ -40,6 +40,9 @@ Core and Builtins ...@@ -40,6 +40,9 @@ Core and Builtins
Library 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 #29085: Allow random.Random.seed() to use high quality OS randomness - Issue #29085: Allow random.Random.seed() to use high quality OS randomness
rather than the pid and time. rather than the pid and time.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment