GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Bounded TypeVar inferred as object for nested covariant generic arguments · Issue #22331 · python/mypy Open DescriptionBug report Mypy infers Reproducer from typing import Generic, TypeVar class Model: pass class Person(Model): pass class Audit(Model): pass M = TypeVar("M", bound=Model, covariant=True) class QuerySet(Generic[M]): pass Q = TypeVar("Q", bound=QuerySet[Model], covariant=True) L = TypeVar("L", bound=str, covariant=True) P = TypeVar("P", bound=Person) class Prefetch(Generic[L, Q]): def __init__(self, lookup: L, queryset: Q) -> None: ... def accept(*items: Prefetch[L, Q]) -> None: ... def example(people: QuerySet[P], audits: QuerySet[Audit]) -> None: accept(Prefetch("left", queryset=people), Prefetch("audit", queryset=audits)) Expected: the call is accepted; Actual: Annotating each argument as Environment: Python 3.14.6; reproduced on mypy 2.4.1 and unmodified master Originally reported as typeddjango/django-stubs#3770. The draft stubs PR bypasses this inference and is being withdrawn in favor of reporting the checker issue. Investigation and reproducer prepared with AI assistance. Activity
MetadataMetadataAssigneesLabelsNo labels ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |