gh-59110: Fix a debug output for implicit directories (GH-121375)

This commit is contained in:
Serhiy Storchaka 2024-07-05 11:44:07 +03:00 committed by GitHub
parent db39bc42f9
commit cecd6012b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -558,6 +558,7 @@ def _read_directory(archive):
_bootstrap._verbose_message('zipimport: found {} names in {!r}', count, archive) _bootstrap._verbose_message('zipimport: found {} names in {!r}', count, archive)
# Add implicit directories. # Add implicit directories.
count = 0
for name in list(files): for name in list(files):
while True: while True:
i = name.rstrip(path_sep).rfind(path_sep) i = name.rstrip(path_sep).rfind(path_sep)
@ -568,8 +569,9 @@ def _read_directory(archive):
break break
files[name] = None files[name] = None
count += 1 count += 1
_bootstrap._verbose_message('zipimport: added {} implicit directories in {!r}', if count:
count, archive) _bootstrap._verbose_message('zipimport: added {} implicit directories in {!r}',
count, archive)
return files return files
# During bootstrap, we may need to load the encodings # During bootstrap, we may need to load the encodings