Skip to content

Commit a9d791a

Browse files
Clean up zipimporter initialisation
1 parent 3be0af8 commit a9d791a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Lib/zipimport.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,8 @@ def __init__(self, path):
8888
raise ZipImportError('not a Zip file', path=path)
8989
break
9090

91-
try:
92-
files = _zip_directory_cache[path]
93-
except KeyError:
94-
files = _read_directory(path)
95-
_zip_directory_cache[path] = files
91+
if path not in _zip_directory_cache:
92+
_zip_directory_cache[path] = _read_directory(path)
9693
self._cache_is_valid = True
9794
self.archive = path
9895
# a prefix directory following the ZIP file path.

0 commit comments

Comments
 (0)