-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when using member type aliases in runtime contexts (#13602)
This pull request: - Fixes #10357 - Fixes #9908 Currently, checkmember.py attempts handling only type aliases with Instance targets and ignores type aliases with a special form target such as `Union[...]`, `Literal[...]`, or `Callable[...]`, causing either a crash or odd runtime behavior. This diff replaces that logic (the `instance_alias_type` function) with the more general-purpose `alias_type_in_runtime_context` function found in checkexpr.py. I'm not actually 100% sure if the latter is a perfect substitute for the former -- the two functions seem to handle Instance type aliases a little differently. But I think this is probably fine: the long-term benefits of consolidating mypy's logic is probably worth some short-term risk.
- Loading branch information
1 parent
8eb9cdc
commit 71e19e8
Showing
5 changed files
with
167 additions
and
33 deletions.
There are no files selected for viewing
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
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