mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Remove some dead code in importlib, introduced with the PEP 451 patch.
Early in the PEP 451 implementation some of the importlib loaders had their own _get_spec() methods to simplify accommodating them. However, later implementations removed the need. They simply failed to remove this code at the same time. :)
This commit is contained in:
parent
fc45f173a3
commit
61e851baca
2 changed files with 983 additions and 994 deletions
|
@ -1934,15 +1934,10 @@ class FileFinder:
|
||||||
return None, []
|
return None, []
|
||||||
return spec.loader, spec.submodule_search_locations or []
|
return spec.loader, spec.submodule_search_locations or []
|
||||||
|
|
||||||
def _get_spec(self, loader_class, fullname, path, submodule_search_locations, target):
|
def _get_spec(self, loader_class, fullname, path, smsl, target):
|
||||||
loader = loader_class(fullname, path)
|
loader = loader_class(fullname, path)
|
||||||
try:
|
return spec_from_file_location(fullname, path, loader=loader,
|
||||||
get_spec = loader._get_spec
|
submodule_search_locations=smsl)
|
||||||
except AttributeError:
|
|
||||||
return spec_from_file_location(fullname, path, loader=loader,
|
|
||||||
submodule_search_locations=submodule_search_locations)
|
|
||||||
else:
|
|
||||||
return get_spec(fullname, path, submodule_search_locations, target)
|
|
||||||
|
|
||||||
def find_spec(self, fullname, target=None):
|
def find_spec(self, fullname, target=None):
|
||||||
"""Try to find a loader for the specified module, or the namespace
|
"""Try to find a loader for the specified module, or the namespace
|
||||||
|
|
1966
Python/importlib.h
1966
Python/importlib.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue