summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-01 17:00:30 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-01 17:00:30 (GMT)
commit34cba334034ddef3b32e47bf94cb7d224cfaf15d (patch)
tree7061090d58a054f396693d984b7d6e38113690e6
parentb47913f54f7b09189f0695144b26e85d87227d3d (diff)
downloadcpython-34cba334034ddef3b32e47bf94cb7d224cfaf15d.zip
cpython-34cba334034ddef3b32e47bf94cb7d224cfaf15d.tar.gz
cpython-34cba334034ddef3b32e47bf94cb7d224cfaf15d.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.
-rw-r--r--Lib/zipfile.py5
-rw-r--r--Misc/NEWS3
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 2476717..048f60a 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1028,11 +1028,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()
diff --git a/Misc/NEWS b/Misc/NEWS
index 0dd4ef1..ad67b1d 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -140,6 +140,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 #13051: Fixed recursion errors in large or resized
curses.textpad.Textbox. Based on patch by Tycho Andersen.