[Python-checkins] cpython: Remove some dead code in importlib, introduced with the PEP 451 patch.

eric.snow python-checkins at python.org
Thu Dec 19 07:36:13 CET 2013


http://hg.python.org/cpython/rev/6f41495e9336
changeset: 88051:6f41495e9336
user: Eric Snow <ericsnowcurrently at gmail.com>
date: Wed Dec 18 23:35:15 2013 -0700
summary:
 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. :)
files:
 Lib/importlib/_bootstrap.py | 11 +-
 Python/importlib.h | 1966 +++++++++++-----------
 2 files changed, 983 insertions(+), 994 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1934,15 +1934,10 @@
 return None, []
 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)
- try:
- get_spec = loader._get_spec
- 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)
+ return spec_from_file_location(fullname, path, loader=loader,
+ submodule_search_locations=smsl)
 
 def find_spec(self, fullname, target=None):
 """Try to find a loader for the specified module, or the namespace
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /