8000 Fix more crashes in class scoped imports by hauntsaninja · Pull Request #12199 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix more crashes in class scoped imports #12199

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 6 commits into from
Feb 17, 2022
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
Next Next commit
fix tests
  • Loading branch information
hauntsaninja committed Feb 17, 2022
commit 50ef027be4f27e94287e4f1ec04bcfb767693c3d
2 changes: 1 addition & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4810,7 +4810,7 @@ def _get_node_for_class_scoped_import(
existing is not None
and isinstance(f(existing.node), (FuncBase, Var))
and (
isinstance(get_proper_type(f(existing.type)), AnyType)
isinstance(f(existing.type), f(AnyType))
or f(existing.type) == f(symbol_node).type
)
):
Expand Down
5 changes: 3 additions & 2 deletions test-data/unit/fine-grained-modules.test
Original file line number Diff line number Diff line change
Expand Up @@ -1509,11 +1509,12 @@ class C: pass
main:3: error: Name "f" is not defined
main:4: error: Name "C" is not defined
==
main:3: error: Missing positional argument "x" in call to "f"
main:2: error: Unsupported class scoped import
main:4: error: Name "C" is not defined
==
main:3: error: Missing positional argument "x" in call to "f"
main:2: error: Unsupported class scoped import
==
main:2: error: Unsupported class scoped import

[case testImportStarAddMissingDependencyInsidePackage1]
from p.b import f
Expand Down
0