This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: NamespaceLoader does not implement create_module or exec_module
Type: Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: FFY00, brett.cannon, eric.snow, ncoghlan
Priority: normal Keywords:

Created on 2021-10-23 21:36 by FFY00, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg404913 - (view) Author: Filipe Laíns (FFY00) * (Python triager) Date: 2021-10-23 21:36
NamespaceLoader currently does not implement create_module or exec_module, which is problematic since load_module is deprecated.

The create_module docstring is the same as _LoaderBasics:

```
def create_module(self, spec):
    """Use default semantics for module creation."""
```

Is it intended to be empty, or is NamespaceLoader unfinished?

If this is intended, how should we create the module instead? If there is other part of the code dealing this, via a fallback in case the loader does not implement this method, wouldn't it make sense to put that in in the loader itself for standalone use?
msg404995 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2021-10-25 19:18
create_module() being empty is on purpose: https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.create_module . You only define create_module() if you need a specific type of object for the module instance.
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89755
2021-10-25 19:18:19brett.cannonsetmessages: + msg404995
2021-10-23 21:36:36FFY00create