-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
gh-20542: Fix crash in split_for_callable when passing values to variadic generics #20543
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
hauntsaninja
merged 3 commits into
python:master
from
a12k:fix-checkexpr-assumption-all-type-args-type-objs
Jan 13, 2026
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you add
or not t.is_type_obj()? Does mypy error later? The error message you added isn't very clear IMO.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking if we added
or not t.is_type_obj()to the guard it would return more generic errors. In the test below, the return isInvalid type: try using Literal[1] instead?but with the additional guard I think it would be something likeerror: Type expected?, which is correct, but not as specific as it could be.I probably should use the messagebuilder for the error though. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which one is the current? Neither matches what you have ATM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I'm sorry, I misread what line you were commenting on. You're saying why not turn
if not vars or not any(isinstance(v, TypeVarTupleType) for v in vars):toif not vars or not any(isinstance(v, TypeVarTupleType) for v in vars) or not t.is_type_object().I tried this and we produce the
Type application is only supported for generic classesandInvalid type: try using Literal[1] instead?in the test against this part of the code. Looking at it, I'm thinking this is likely a lot cleaner and I would just suggest striking my current changes and changing to simply appendingor not t.is_type_object()to line 4966. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that seems like a better error output, if I'm understanding correctly.