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

Co-authored-by: Miguel Brito <5544985+miguendes@users.noreply.github.com>
This commit is contained in:
Steve Dower 2021-05-12 10:48:50 +01:00 committed by GitHub
parent 6c190b5ae5
commit 0cb9775a85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 0 deletions

View file

@ -412,6 +412,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: