[red-knot] avoid inferring types if unpacking fails#16530
Merged
carljm merged 2 commits intoastral-sh:mainfrom Mar 7, 2025
Merged
[red-knot] avoid inferring types if unpacking fails#16530carljm merged 2 commits intoastral-sh:mainfrom
carljm merged 2 commits intoastral-sh:mainfrom
Conversation
dhruvmanila
requested changes
Mar 7, 2025
Member
dhruvmanila
left a comment
There was a problem hiding this comment.
Thank you for doing this! There are couple of changes around simplification and using Unknown even in the case of starred unpacking but otherwise this looks good.
ce1bd07 to
576b63c
Compare
carljm
approved these changes
Mar 7, 2025
Contributor
carljm
left a comment
There was a problem hiding this comment.
Looks good to me with the changes from Dhruv's review!
dcreager
added a commit
that referenced
this pull request
Mar 8, 2025
* main: [red-knot] Understand `typing.Callable` (#16493) [red-knot] Support unpacking `with` target (#16469) [red-knot] Attribute access and the descriptor protocol (#16416) [`pep8-naming`] Add links to `ignore-names` options in various rules' documentation (#16557) [red-knot] avoid inferring types if unpacking fails (#16530)
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.
Summary
This PR closes #15199.
The change I just made is to set all variables to type
Unknownif unpacking fails, but in some cases this may be excessive.For example:
I will modify it if you think it would be better to make it a different type than just
Unknown.Test Plan
I have made appropriate modifications to the test cases affected by this change, and also added some more test cases.