diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2014-01-07 03:42:59 (GMT) |
---|---|---|
committer | Eric Snow <ericsnowcurrently@gmail.com> | 2014-01-07 03:42:59 (GMT) |
commit | 02b9f9d6bb596d437ac10d71afac8a4781d18d86 (patch) | |
tree | 1193a4aa2a6b434eb4fc6bea0e561d32b5dafb80 /Lib/pkgutil.py | |
parent | 3a62d14b24843de4884ea8d0167bc1285b285a97 (diff) | |
download | cpython-02b9f9d6bb596d437ac10d71afac8a4781d18d86.zip cpython-02b9f9d6bb596d437ac10d71afac8a4781d18d86.tar.gz cpython-02b9f9d6bb596d437ac10d71afac8a4781d18d86.tar.bz2 |
Remove more usage of APIs deprecated by PEP 451.
Diffstat (limited to 'Lib/pkgutil.py')
-rw-r--r-- | Lib/pkgutil.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py index 405a03d..7beae12 100644 --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -554,13 +554,14 @@ def extend_path(path, name): finder = get_importer(dir) if finder is not None: + portions = [] + if hasattr(finder, 'find_spec'): + spec = finder.find_spec(final_name) + if spec is not None: + portions = spec.submodule_search_locations or [] # Is this finder PEP 420 compliant? - if hasattr(finder, 'find_loader'): - loader, portions = finder.find_loader(final_name) - else: - # No, no need to call it - loader = None - portions = [] + elif hasattr(finder, 'find_loader'): + _, portions = finder.find_loader(final_name) for portion in portions: # XXX This may still add duplicate entries to path on |