Fix crash on ErasedType and covers_at_runtime#11924
Merged
JukkaL merged 5 commits intopython:masterfrom Jan 7, 2022
sobolevn:issue-11913
Merged
Fix crash on ErasedType and covers_at_runtime#11924JukkaL merged 5 commits intopython:masterfrom sobolevn:issue-11913
ErasedType and covers_at_runtime#11924JukkaL merged 5 commits intopython:masterfrom
sobolevn:issue-11913
Conversation
JukkaL
reviewed
Jan 6, 2022
mypy/subtypes.py
Outdated
| item = get_proper_type(item) | ||
| supertype = get_proper_type(supertype) | ||
| if (isinstance(item, (ErasedType, DeletedType)) | ||
| or isinstance(supertype, (ErasedType, DeletedType))): |
Collaborator
There was a problem hiding this comment.
Hmm I wonder if ErasedType instances can be nested inside unions, for example, and still cause a crash. Maybe erase_type should just propagate erased types unmodified? I don't think that DeletedType can be nested so it seems safe to handle here, though I'm not sure we need special casing for it. Did you find a use case where we encounter deleted types here, or is it here more as a defensive measure?
Member
Author
There was a problem hiding this comment.
Hm, good idea. I will try it!
Did you find a use case where we encounter deleted types here, or is it here more as a defensive measure?
More like a defensive programming. I will remove it, because it does not make much sense without ErasedType.
hauntsaninja
reviewed
Jan 6, 2022
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
tushar-deepsource
pushed a commit
to DeepSourceCorp/mypy
that referenced
this pull request
Jan 20, 2022
Closes python#11913 Refs python#11273 Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11913
Refs #11273
CC @hauntsaninja