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.
This commit is contained in:
Brett Cannon 2014-05-30 14:55:29 -04:00
parent c8f0d6ebfc
commit 2a17bde930
17 changed files with 4536 additions and 4736 deletions

View file

@ -616,7 +616,7 @@ def get_data(package, resource):
return None
# XXX needs test
mod = (sys.modules.get(package) or
importlib._bootstrap._SpecMethods(spec).load())
importlib._bootstrap._load(spec))
if mod is None or not hasattr(mod, '__file__'):
return None