-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Feature or enhancement
Proposal:
cpython/Lib/zipfile/__init__.py
Lines 1164 to 1177 in 78ffba4
# 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
- GH-128131: Random access uncompressed unencrypted ZipExtFile #128132
- GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile #128143
- [3.13] GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) #129091
- [3.12] GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) #129092
Metadata
Metadata
Assignees
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done