-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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
Conversation
…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
There was a problem hiding this 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!
I don't think we need a news item for this so I added the |
I agree on the |
@warsaw: Please replace |
The namespace package
importlib._bootstrap.ModuleSpec.loader
attribute is no longerNone
after calling theimportlib._bootstrap._init_module_attrs
function. But a namespace package can be detected with itsimportlib._bootstrap.ModuleSpec.origin
attribute which is alwaysNone
.See https://stackoverflow.com/questions/52869541/namespace-package-spec-loader-and-loader-attributes-not-set-to-none
https://bugs.python.org/issue35181