summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorMickaƫl Schoentgen <contact@tiger-222.fr>2018-07-29 18:26:52 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-07-29 18:26:52 (GMT)
commit3f8c6913b82ed9c05e57175bcbfeacde46c598e3 (patch)
tree5a548963a242aa533ccd529028928724c6dcb093 /Lib/zipfile.py
parentd2e902e4fb304f27e4a72356efbc1fc26be3935d (diff)
downloadcpython-3f8c6913b82ed9c05e57175bcbfeacde46c598e3.zip
cpython-3f8c6913b82ed9c05e57175bcbfeacde46c598e3.tar.gz
cpython-3f8c6913b82ed9c05e57175bcbfeacde46c598e3.tar.bz2
bpo-34035: Fix several AttributeError in zipfile seek() methods. (GH-8527)
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index b90b60f..2757ce9 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -701,11 +701,11 @@ class _SharedFile:
def seek(self, offset, whence=0):
with self._lock:
- if self.writing():
+ if self._writing():
raise ValueError("Can't reposition in the ZIP file while "
"there is an open writing handle on it. "
"Close the writing handle before trying to read.")
- self._file.seek(self._pos)
+ self._file.seek(offset, whence)
self._pos = self._file.tell()
return self._pos
@@ -1021,14 +1021,13 @@ class ZipExtFile(io.BufferedIOBase):
read_offset = 0
elif read_offset < 0:
# Position is before the current position. Reset the ZipExtFile
-
self._fileobj.seek(self._orig_compress_start)
self._running_crc = self._orig_start_crc
self._compress_left = self._orig_compress_size
self._left = self._orig_file_size
self._readbuffer = b''
self._offset = 0
- self._decompressor = zipfile._get_decompressor(self._compress_type)
+ self._decompressor = _get_decompressor(self._compress_type)
self._eof = False
read_offset = new_pos