[issue23014] Don't have importlib.abc.Loader.create_module() be optional

Brett Cannon report at bugs.python.org
Mon Dec 8 17:18:58 CET 2014


New submission from Brett Cannon:

I continue to be bothered by how we designed importlib.abc.Loader.create_module(). I don't like that it's optional and I don't like that it can return None.

I would much rather make it so that importlib.abc.Loader.create_module() was a static method that does what importlib.util.module_from_spec() does. I would also like importlib to throw a fit if exec_module() was defined on a loader but not create_module() with a DeprecationWarning to start and then an AttributeError later (as I said, this requires exec_module() defined and does not play into the whole load_module() discussion). This should also hopefully promote people subclassing importlib.abc.Loader more as well.

What do other people think?

----------
components: Interpreter Core
messages: 232313
nosy: brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: Don't have importlib.abc.Loader.create_module() be optional
type: behavior
versions: Python 3.5, Python 3.6

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


More information about the Python-bugs-list mailing list