[issue20383] Add a keyword-only spec argument to types.ModuleType

Brett Cannon report at bugs.python.org
Mon May 19 00:32:20 CEST 2014


Brett Cannon added the comment:

Here is an implementation of importlib.util.module_from_spec(). With this it makes PEP 451 conceptually work like:

  spec = importlib.util.find_spec(name)
  module = importlib.util.module_from_spec(spec)
  spec.loader.exec_module(module)

About the only other thing I can think of that people might still want is something like `importlib.util.load(spec)` so that they don't even need to care about whether load_module() or exec_module() is defined, but that can be a separate issue if it turns out people actually want something like that.

----------
keywords: +patch
stage: test needed -> commit review
Added file: http://bugs.python.org/file35286/module_from_spec.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20383>
_______________________________________


More information about the Python-bugs-list mailing list