Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61e851b

Browse files
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. :)
1 parent fc45f17 commit 61e851b

2 files changed

Lines changed: 983 additions & 994 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,15 +1934,10 @@ def find_loader(self, fullname):
19341934
return None, []
19351935
return spec.loader, spec.submodule_search_locations or []
19361936

1937-
def _get_spec(self, loader_class, fullname, path, submodule_search_locations, target):
1937+
def _get_spec(self, loader_class, fullname, path, smsl, target):
19381938
loader = loader_class(fullname, path)
1939-
try:
1940-
get_spec = loader._get_spec
1941-
except AttributeError:
1942-
return spec_from_file_location(fullname, path, loader=loader,
1943-
submodule_search_locations=submodule_search_locations)
1944-
else:
1945-
return get_spec(fullname, path, submodule_search_locations, target)
1939+
return spec_from_file_location(fullname, path, loader=loader,
1940+
submodule_search_locations=smsl)
19461941

19471942
def find_spec(self, fullname, target=None):
19481943
"""Try to find a loader for the specified module, or the namespace

0 commit comments

Comments
 (0)