8000 Fix crash on follow_imports_for_stubs by ilevkivskyi · Pull Request #15407 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix crash on follow_imports_for_stubs #15407

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

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update tests; delete _importlib_modulespec
  • Loading branch information
ilevkivskyi committed Jun 9, 2023
commit 9ae347c083f26fe70e2054ddddba04607fb5bc3f
3 changes: 0 additions & 3 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
"types",
"typing_extensions",
"mypy_extensions",
"_importlib_modulespec",
"_typeshed",
"_collections_abc",
"collections",
Expand Down Expand Up @@ -663,8 +662,6 @@ def __init__(
for module in CORE_BUILTIN_MODULES:
if options.use_builtins_fixtures:
continue
if module == "_importlib_modulespec":
continue
path = self.find_module_cache.find_module(module)
if not isinstance(path, str):
raise CompileError(
Expand Down
2 changes: 1 addition & 1 deletion mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,7 @@ def format_literal_value(typ: LiteralType) -> str:
if isinstance(typ, Instance):
itype = typ
# Get the short name of the type.
if itype.type.fullname in ("types.ModuleType", "_importlib_modulespec.ModuleType"):
if itype.type.fullname == "types.ModuleType":
# Make some common error messages simpler and tidier.
base_str = "Module"
if itype.extra_attrs and itype.extra_attrs.mod_name and module_names:
Expand Down
8 changes: 8 additions & 0 deletions test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,10 @@ note: A user-defined top-level module with name "typing" is not supported
[file dir/stdlib/types.pyi]
[file dir/stdlib/typing.pyi]
[file dir/stdlib/typing_extensions.pyi]
[file dir/stdlib/_typeshed.pyi]
[file dir/stdlib/_collections_abc.pyi]
[file dir/stdlib/collections/abc.pyi]
[file dir/stdlib/collections/__init__.pyi]
[file dir/stdlib/VERSIONS]
[out]
Failed to find builtin module mypy_extensions, perhaps typeshed is broken?
Expand Down Expand Up @@ -1523,6 +1527,10 @@ class dict: pass
[file dir/stdlib/typing.pyi]
[file dir/stdlib/mypy_extensions.pyi]
[file dir/stdlib/typing_extensions.pyi]
[file dir/stdlib/_typeshed.pyi]
[file dir/stdlib/_collections_abc.pyi]
[file dir/stdlib/collections/abc.pyi]
[file dir/stdlib/collections/__init__.pyi]
[file dir/stdlib/foo.pyi]
1() # Errors are reported if the file was explicitly passed on the command line
[file dir/stdlib/VERSIONS]
Expand Down
0