]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-59110: Fix a debug output for implicit directories (GH-121375)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 5 Jul 2024 08:44:07 +0000 (11:44 +0300)
committerGitHub <noreply@github.com>
Fri, 5 Jul 2024 08:44:07 +0000 (11:44 +0300)
Lib/zipimport.py

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