vvb2060 · GitHub

Feature or enhancement

Proposal:

# Fast seek uncompressed unencrypted file
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
read_offset -= len(self._readbuffer) - self._offset
self._fileobj.seek(read_offset, os.SEEK_CUR)
self._left -= read_offset
read_offset = 0
# flush read buffer
self._readbuffer = b''
self._offset = 0
elif read_offset < 0:
# Position is before the current position. Reset the ZipExtFile

if read_offset < 0, ZipExtFile is reset and read from the beginning. I think read_offset > 0 is unnecessary.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Read the original on github.com ↗