Issue #26397: Update an importlib example to use util.module_from_spec() instead of create_module()

This commit is contained in:
Brett Cannon 2016-02-20 18:45:56 -08:00
parent fe1941ebf8
commit 4cbab346df

View file

@ -1389,7 +1389,7 @@ Python 3.6 and newer for other parts of the code).
break break
else: else:
raise ImportError(f'No module named {absolute_name!r}') raise ImportError(f'No module named {absolute_name!r}')
module = spec.loader.create_module(spec) module = util.module_from_spec(spec)
spec.loader.exec_module(module) spec.loader.exec_module(module)
sys.modules[absolute_name] = module sys.modules[absolute_name] = module
if path is not None: if path is not None: