You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bounded TypeVar inferred as object for nested covariant generic arguments #22331
Mypy infers object for a bounded type variable when combining covariant generic arguments, although their common upper bound is valid. This reproduces without Django or plugins.
Expected: the call is accepted; Q = QuerySet[Model] satisfies both arguments and its bound.
Actual:
error: Value of type variable "Q" of "accept" cannot be "object" [type-var]
Annotating each argument as Prefetch[str, QuerySet[Model]] before the call succeeds. Using concrete QuerySet[Person] instead of QuerySet[P], or removing the L parameter from Prefetch, also succeeds. Merely assigning the arguments to unannotated intermediate variables does not help.
Environment: Python 3.14.6; reproduced on mypy 2.4.1 and unmodified master d8a43fbcf21e30bd7855b5635bdd2f07ffbb5d95, without plugins or project configuration (--no-incremental --cache-dir=/dev/null --config-file=/dev/null).
Activity
Anurag-S1ngh commentedon Oct 31, 2026
Hi, I'd like to take this issue. Could you assign it to me?