Skip to content

Commit c216e08

Browse files
Actually fix the "cleaned up" version
1 parent 6ea9497 commit c216e08

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,19 +1619,14 @@ def find_spec(self, fullname, target=None):
16191619
self._fill_cache()
16201620
self._path_mtime = mtime
16211621
# tail_module keeps the original casing, for __file__ and friends
1622+
if not tail_module.isascii() and not self._cache_is_normalized:
1623+
self._normalize_cache()
16221624
if _relax_case():
16231625
cache_module = tail_module.lower()
16241626
cache = self._relaxed_path_cache
1625-
1626-
if not cache_module.isascii() and not self._cache_is_normalized:
1627-
self._normalize_cache()
16281627
else:
16291628
cache_module = tail_module
16301629
cache = self._path_cache
1631-
1632-
if not cache_module.isascii() and not self._cache_is_normalized:
1633-
self._normalize_cache()
1634-
16351630
# Check if the module is the name of a directory (and thus a package).
16361631
if cache_module in cache:
16371632
base_path = _path_join(self.path, tail_module)
@@ -1696,6 +1691,9 @@ def _fill_cache(self):
16961691
self._cache_is_normalized = False
16971692

16981693
def _normalize_cache(self):
1694+
"""
1695+
Normalize all entries in the caches to NFKC.
1696+
"""
16991697
from unicodedata import normalize
17001698

17011699
self._path_cache = { normalize('NFKC', p) for p in self._path_cache }

0 commit comments

Comments
 (0)