summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/zipfile')
-rw-r--r--Lib/zipfile/__init__.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
index 995d267..2b28a07 100644
--- a/Lib/zipfile/__init__.py
+++ b/Lib/zipfile/__init__.py
@@ -1136,8 +1136,12 @@ class ZipExtFile(io.BufferedIOBase):
read_offset = new_pos - curr_pos
buff_offset = read_offset + self._offset
+ if buff_offset >= 0 and buff_offset < len(self._readbuffer):
+ # Just move the _offset index if the new position is in the _readbuffer
+ self._offset = buff_offset
+ read_offset = 0
# Fast seek uncompressed unencrypted file
- if self._compress_type == ZIP_STORED and self._decrypter is None and read_offset > 0:
+ elif self._compress_type == ZIP_STORED and self._decrypter is None and read_offset > 0:
# disable CRC checking after first seeking - it would be invalid
self._expected_crc = None
# seek actual file taking already buffered data into account
@@ -1148,10 +1152,6 @@ class ZipExtFile(io.BufferedIOBase):
# flush read buffer
self._readbuffer = b''
self._offset = 0
- elif buff_offset >= 0 and buff_offset < len(self._readbuffer):
- # Just move the _offset index if the new position is in the _readbuffer
- self._offset = buff_offset
- read_offset = 0
elif read_offset < 0:
# Position is before the current position. Reset the ZipExtFile
self._fileobj.seek(self._orig_compress_start)