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
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
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 |
…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
The namespace package
importlib._bootstrap.ModuleSpec.loaderattribute is no longerNoneafter calling theimportlib._bootstrap._init_module_attrsfunction. But a namespace package can be detected with itsimportlib._bootstrap.ModuleSpec.originattribute 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