Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NamespaceLoader does not implement create_module or exec_module #89755

Closed
FFY00 opened this issue Oct 23, 2021 · 4 comments
Closed

NamespaceLoader does not implement create_module or exec_module #89755

FFY00 opened this issue Oct 23, 2021 · 4 comments

Comments

@FFY00
Copy link
Member

FFY00 commented Oct 23, 2021

BPO 45592
Nosy @brettcannon, @ncoghlan, @ericsnowcurrently, @FFY00

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-10-23.21:36:36.382>
labels = []
title = 'NamespaceLoader does not implement create_module or exec_module'
updated_at = <Date 2021-10-25.19:18:19.217>
user = 'https://github.com/FFY00'

bugs.python.org fields:

activity = <Date 2021-10-25.19:18:19.217>
actor = 'brett.cannon'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-10-23.21:36:36.382>
creator = 'FFY00'
dependencies = []
files = []
hgrepos = []
issue_num = 45592
keywords = []
message_count = 2.0
messages = ['404913', '404995']
nosy_count = 4.0
nosy_names = ['brett.cannon', 'ncoghlan', 'eric.snow', 'FFY00']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue45592'
versions = []

@FFY00
Copy link
Member Author

FFY00 commented Oct 23, 2021

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?

@brettcannon
Copy link
Member

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@warsaw
Copy link
Member

warsaw commented May 2, 2022

@FFY00 given @brettcannon 's answer above, is there anything still to do for this ticket or can we close it?

@FFY00
Copy link
Member Author

FFY00 commented May 2, 2022

I don't think so, thanks!

@FFY00 FFY00 closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants