Skip to content

Commit

Permalink
Fix missing import in zipimport
Browse files Browse the repository at this point in the history
Summary: see python/cpython#118107

Reviewed By: bowiechen

Differential Revision: D56360822

fbshipit-source-id: 20f2d27f99ad0999a6b98c730a67aeac11c568eb
  • Loading branch information
itamaro authored and facebook-github-bot committed Apr 19, 2024
1 parent 5571ad6 commit a4b51a0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Lib/zipimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ def _read_directory(archive):
num_extra_values = (len(extra_data) - 4) // 8
if num_extra_values > 3:
raise ZipImportError(f"can't read header extra: {archive!r}", path=archive)
import struct # for unpack_from
values = struct.unpack_from(f"<{min(num_extra_values, 3)}Q",
extra_data, offset=4)

Expand Down

0 comments on commit a4b51a0

Please sign in to comment.