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

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

Merged
merged 1 commit into from May 1, 2019

Conversation

Copy link
Contributor

@maggyero maggyero 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 awaiting review labels Nov 7, 2018
@maggyero maggyero 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
@maggyero maggyero 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
@maggyero maggyero 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
@brettcannon brettcannon requested review from warsaw and ericvsmith Nov 7, 2018
@maggyero maggyero 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
@maggyero maggyero 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
@maggyero maggyero 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

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

@warsaw 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

@ericvsmith ericvsmith commented May 1, 2019

I agree on the skip news label.

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

@bedevere-bot bedevere-bot commented May 1, 2019

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

@maggyero maggyero deleted the patch-3 branch May 2, 2019
arnolddumas pushed a commit to arnolddumas/cpython that referenced this issue May 3, 2019
…ger None (python#10376)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA signed docs skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants