KEMBAR78
Fix crash with type alias to `Callable[[Unpack[Tuple[Any, ...]]], Any]` by AlexWaygood · Pull Request #16541 · python/mypy · GitHub
Skip to content

Conversation

AlexWaygood
Copy link
Member

Fixes #16533

@github-actions

This comment has been minimized.

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)
Copy link
Collaborator

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?

Copy link
Member Author

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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2023

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@JukkaL JukkaL left a 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!

@JukkaL JukkaL merged commit 5fa9569 into python:master Dec 12, 2023
@AlexWaygood AlexWaygood deleted the fix-tvar-tuple-crash branch December 12, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal error with an alias type that is a callable with an unpacked tuple as args

2 participants