-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix importing of namespace packages and built-in modules
* Namespace packages commonly don't use `_NamespaceLoader`, and it is an implementation detail in any case. The loader is then set to None. There is no need to inspect the loader anyway. Everything we need is on the `spec`. The unit test had a "work-around" for this, but this does not happen in real usage. * There are more built-in modules than just "builtins". The full list is available in `sys.builtin_module_names`[1]. However, we don't need to handle them specially. * It is also hard to know if a standard library module is built as an extension or a built-in. For example, in my Ubuntu 22.04's build of python 3.10 both `_pickle` and `_elementtree` modules are built-in[2]. Use a third-party module (`ujson`) for tests, which is guaranteed to be an extension module. * pydantic's `__init__` is no longer an extension module, so use mypyc instead, which we already have through mypy. [1] https://docs.python.org/3/library/sys.html#sys.builtin_module_names [2] https://github.com/python/cpython/blob/519b2ae22b54760475bbf62b9558d453c703f9c6/PC/config.c#L87
- Loading branch information
Showing
7 changed files
with
124 additions
and
163 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This file is needed for the overrides in mypy.ini to work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This module is shadowed by the builtin module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters