bpo-44061: Fix pkgutil.iter_modules regression when passed a pathlib.Path object (GH-25964)

This commit is contained in:
Miguel Brito 2021-05-12 00:27:22 +01:00 committed by GitHub
parent 8563a7052c
commit e9d7f88d56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 0 deletions

View file

@ -413,6 +413,7 @@ def get_importer(path_item):
The cache (or part of it) can be cleared manually if a
rescan of sys.path_hooks is necessary.
"""
path_item = os.fsdecode(path_item)
try:
importer = sys.path_importer_cache[path_item]
except KeyError: