[ty] Fix bug where ty would think that a Callable with a variadic positional parameter could be a subtype of a Callable with a positional-or-keyword parameter by AlexWaygood · Pull Request #23610 · astral-sh/ruff (original) (raw)

and others added 2 commits

February 27, 2026 14:40

@claude

…rd params

When a variadic (*args) parameter was matched against positional-or-keyword parameters from the supertype, those parameters were collected for keyword checking later. However, if both parameter iterators were exhausted simultaneously, the loop returned early without verifying that the keyword portion of those parameters could also be satisfied. This caused (*args: int) to incorrectly be considered a subtype of (a: int), even though a can be passed as a keyword argument which *args cannot accept.

The fix ensures that when unmatched keyword parameters exist, the loop breaks to the keyword-matching code instead of returning early.

https://claude.ai/code/session_015KWJHraC4EMq4ruyp78ESc

@AlexWaygood

carljm added a commit that referenced this pull request

Feb 27, 2026

@carljm

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

[ Show hidden characters]({{ revealButtonHref }})