-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix crash with type alias to Callable[[Unpack[Tuple[Any, ...]]], Any]
#16541
Conversation
This comment has been minimized.
This comment has been minimized.
mypy/expandtype.py
Outdated
expanded_tuple = var_arg_type.accept(self) | ||
assert isinstance(expanded_tuple, ProperType) and isinstance(expanded_tuple, TupleType) | ||
expanded_items = expanded_tuple.items | ||
fallback = var_arg_type.partial_fallback | ||
elif isinstance(var_arg_type, Instance): | ||
# We have something like Unpack[Tuple[Any, ...]] | ||
expanded_items = list(var_arg_type.args) |
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.
Should we preserve this as an Instance
? Are we converting a variable-length tuple to a single-item tuple?
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.
Thanks, I see what you mean (I think)! Does e4d02a4 address this?
I'm surprised no tests failed as a result of this.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
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.
Thanks for the fix!
Fixes #16533