diff options
author | Brett Cannon <brett@python.org> | 2014-05-30 18:55:29 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2014-05-30 18:55:29 (GMT) |
commit | 2a17bde930af72995a217f6625d763e828bf5ce1 (patch) | |
tree | e36ddef450d49c50b324d5e2741161f9ea22188c /Lib/pydoc.py | |
parent | c8f0d6ebfc8e114d72c9e642ed33ebb93276427d (diff) | |
download | cpython-2a17bde930af72995a217f6625d763e828bf5ce1.zip cpython-2a17bde930af72995a217f6625d763e828bf5ce1.tar.gz cpython-2a17bde930af72995a217f6625d763e828bf5ce1.tar.bz2 |
Issue #20383: Introduce importlib.util.module_from_spec().
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 220a3cb..42f65dc 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -263,9 +263,8 @@ def synopsis(filename, cache={}): # XXX We probably don't need to pass in the loader here. spec = importlib.util.spec_from_file_location('__temp__', filename, loader=loader) - _spec = importlib._bootstrap._SpecMethods(spec) try: - module = _spec.load() + module = importlib._bootstrap._load(spec) except: return None del sys.modules['__temp__'] @@ -297,9 +296,8 @@ def importfile(path): loader = importlib._bootstrap.SourceFileLoader(name, path) # XXX We probably don't need to pass in the loader here. spec = importlib.util.spec_from_file_location(name, path, loader=loader) - _spec = importlib._bootstrap._SpecMethods(spec) try: - return _spec.load() + return importlib._bootstrap._load(spec) except: raise ErrorDuringImport(path, sys.exc_info()) @@ -2057,9 +2055,8 @@ class ModuleScanner: else: path = None else: - _spec = importlib._bootstrap._SpecMethods(spec) try: - module = _spec.load() + module = importlib._bootstrap._load(spec) except ImportError: if onerror: onerror(modname) |