fix(checker): avoid false overload-cannot-match with ParamSpec args by Bahtya · Pull Request #21194 · python/mypy

and others added 2 commits

April 9, 2026 18:51
When an overload uses ParamSpec-flavored *args (P.args) or **kwargs
(P.kwargs), erasing the ParamSpec to Any makes the signature appear to
accept all arguments. This causes a false 'overload will never be
matched' error when combined with a second overload that has explicit
keyword-only parameters.

Skip the can-never-match check when the first overload has
ParamSpec-flavored variadic arguments, since we cannot reliably
determine overlap after erasure.

Fixes python#21171

Signed-off-by: bahtya <bahtyar153@qq.com>