Skip to content

bpo-35181: Correct an assumption about the namespace package loader attribute #10376

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

Merged
merged 1 commit into from
May 1, 2019

Conversation

geryogam
Copy link
Contributor

@geryogam geryogam commented Nov 7, 2018

The namespace package importlib._bootstrap.ModuleSpec.loader attribute is no longer None after calling the importlib._bootstrap._init_module_attrs function. But a namespace package can be detected with its importlib._bootstrap.ModuleSpec.origin attribute which is always None.

See https://stackoverflow.com/questions/52869541/namespace-package-spec-loader-and-loader-attributes-not-set-to-none

https://bugs.python.org/issue35181

…ger None

Namespace packages _bootstrap.ModuleSpec.loader attributes are no longer `None` _after_ calling the importlib._bootstrap._init_module_attrs function.

See:
* https://stackoverflow.com/questions/52869541/namespace-package-spec-loader-and-loader-attributes-not-set-to-none
* https://bugs.python.org/issue35181
@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Nov 7, 2018
@geryogam geryogam changed the title bpo-35181: Namespace packages _bootstrap.ModuleSpec.loader attributes are no longer None bpo-35181: Namespace packages _bootstrap.ModuleSpec.loader attributes no longer None Nov 7, 2018
@geryogam geryogam changed the title bpo-35181: Namespace packages _bootstrap.ModuleSpec.loader attributes no longer None bpo-35181: Correct a false asumption about namespace packages _bootstrap.ModuleSpec.loader attributes Nov 7, 2018
@geryogam geryogam changed the title bpo-35181: Correct a false asumption about namespace packages _bootstrap.ModuleSpec.loader attributes bpo-35181: Correct an assumption about namespace packages _bootstrap.ModuleSpec.loader attributes Nov 7, 2018
@geryogam geryogam changed the title bpo-35181: Correct an assumption about namespace packages _bootstrap.ModuleSpec.loader attributes bpo-35181: Correct an assumption about namespace package _bootstrap.ModuleSpec.loader attribute Nov 7, 2018
@geryogam geryogam changed the title bpo-35181: Correct an assumption about namespace package _bootstrap.ModuleSpec.loader attribute bpo-35181: Correct an assumption about namespace package loader attribute Nov 7, 2018
@geryogam geryogam changed the title bpo-35181: Correct an assumption about namespace package loader attribute bpo-35181: Correct an assumption about the namespace package loader attribute Nov 7, 2018
Copy link
Member

@warsaw warsaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to approve this, since I think the logic is more right with your change. However, it makes me uncomfortable about the fragility of this code snippet, since it isn't tested. Clearly the buggy code wasn't found when the original change was made. Too bad we don't have doctests for the internal documentation.

Not your problem though, and thanks for your contribution!

@warsaw
Copy link
Member

warsaw commented May 1, 2019

I don't think we need a news item for this so I added the skip news label. Any objections?

@ericvsmith
Copy link
Member

I agree on the skip news label.

@warsaw warsaw merged commit ee88af3 into python:master May 1, 2019
@bedevere-bot
Copy link

@warsaw: Please replace # with GH- in the commit message next time. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants