Skip to content

Commit 26a162b

Browse files
authored
gh-89668: Optimize ZipFile file header processing algorithm to avoid unneeded IO(gh-25966)
1 parent 90e7230 commit 26a162b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/zipfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,7 @@ def open(self, name, mode="r", pwd=None, *, force_zip64=False):
15641564

15651565
fname = zef_file.read(fheader[_FH_FILENAME_LENGTH])
15661566
if fheader[_FH_EXTRA_FIELD_LENGTH]:
1567-
zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])
1567+
zef_file.seek(fheader[_FH_EXTRA_FIELD_LENGTH], whence=1)
15681568

15691569
if zinfo.flag_bits & _MASK_COMPRESSED_PATCH:
15701570
# Zip 2.7: compressed patched data

0 commit comments

Comments
 (0)