When there are two type parameters to widen, mypy widens both to Any, even when the matched overloads agree on the second parameter and only actually disagree on the first.
The issue is that mypy widens multiple type parameters to Any when resolving overloads, even when the matched overloads agree on the second parameter and only disagree on the first. Pyright handles this correctly.
The fix should be in the overload resolution logic — when multiple overloads match, mypy should only widen the type parameters that actually disagree, not all of them.
I'll add a regression test based on the reproducer in the issue.
Activity
DOC: link python/mypy#21903 for the multi-parameter Any-widening
DawnofGenX commented on Oct 2, 2026
I'd like to work on this.
The issue is that mypy widens multiple type parameters to Any when resolving overloads, even when the matched overloads agree on the second parameter and only disagree on the first. Pyright handles this correctly.
The fix should be in the overload resolution logic — when multiple overloads match, mypy should only widen the type parameters that actually disagree, not all of them.
I'll add a regression test based on the reproducer in the issue.