changeset: 105920:f36f9bce997d branch: 3.6 parent: 105915:0331420d6cba parent: 105918:f5aa1c9c2b7e user: Serhiy Storchaka date: Sun Jan 01 19:05:29 2017 +0200 files: Lib/zipfile.py Misc/NEWS description: 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. diff -r 0331420d6cba -r f36f9bce997d Lib/zipfile.py --- a/Lib/zipfile.py Sat Dec 31 22:49:31 2016 +0300 +++ b/Lib/zipfile.py Sun Jan 01 19:05:29 2017 +0200 @@ -1102,11 +1102,12 @@ # 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 -r 0331420d6cba -r f36f9bce997d Misc/NEWS --- a/Misc/NEWS Sat Dec 31 22:49:31 2016 +0300 +++ b/Misc/NEWS Sun Jan 01 19:05:29 2017 +0200 @@ -40,6 +40,9 @@ 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 rather than the pid and time.