Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Nov 28, 2025

Fixes #20093

This fixes the crash, but not the false positive (the false positive existed prior to the regression that introduced the crash)

@overload # E: Single overload definition, multiple required
def foo(x: int) -> None: ...

def foo(*args: int, **kw: str) -> None: # E: Overloaded function implementation does not accept all possible arguments of signature 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related to this PR, just adds #19619 (comment)

mypy/types.py Outdated
typ = vararg.typ
if isinstance(typ, UnpackType):
# Similar to logic in ExpressionChecker.visit_tuple_index_helper
unpacked = get_proper_type(typ.type)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing this here could prevent crashes in other places that don't expect to be handling UnpackType, but may result in false positives because upper_bound is lossy

@github-actions

This comment has been minimized.

@hauntsaninja hauntsaninja marked this pull request as draft November 29, 2025 00:03
@hauntsaninja
Copy link
Collaborator Author

Hmm, maybe this approach is too ambitious for now (e.g. thinking about testTypeVarTupleNotConcreteCallable). Going with something dumber that makes the crash go away

@hauntsaninja hauntsaninja marked this pull request as ready for review November 29, 2025 00:24
@github-actions
Copy link
Contributor

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

Copy link
Collaborator

@sterliakov sterliakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly looks OK as a hotfix for a crashing result. The false positive just remains intact and should be tracked separately. Thanks!

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@ilevkivskyi ilevkivskyi merged commit 66bfe8c into python:master Nov 29, 2025
25 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[regression] meet() crash with Unpacked TypeVarTuple since 1.18.1

3 participants