-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Allow for built-in modules to be submodules #102700
Comments
In GH-102768 @brettcannon wrote:
|
@kesmit13 thanks for opening the issue.
The root issue here is that cpython/Lib/importlib/_bootstrap.py Lines 1262 to 1269 in 405739f
I think the question we want to ask here is if we want to support having a built-in module be a submodule of a normal package? If so, we should simply remove the path check from |
Your comments about |
Thanks, I think it makes sense to drop this limitation. I don't think there's anything else preventing built-in modules from being submodules other than the path check, so removing that check should be all that's needed. |
Bug report
If you statically link a namespaced extension (such as
numpy.core._multiarray_umath
) and add it to the inittab, it will not get loaded properly. In this case, the path to the extension is passed to theBultinImporter.find_spec
method which causes it to returnNone
. The path is a pointer to the namespace of the extension.One possible fix would be to check for a
.
in the name of the extension being loaded. If it contains that, consider it to be a fully-qualified import path and check to see if that fully-qualified name is in the builtins list before moving on to other checks.Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: