ruff
2c32fedd - [ty] Ignore generic specialization in layout compatibility checks (#25178)

Commit
8 days ago
[ty] Ignore generic specialization in layout compatibility checks (#25178) ## Summary Every time someone tries to touch this code, it gets rejected, so I don't have high hopes here. Anyway... Previously, a generic disjoint base and a subclass of that base could be marked as incompatible if the type arguments didn't line up. But at runtime, CPython's instance layout check isn't affected by type arguments. A concrete example is: ```python import asyncio class Future(asyncio.Future): ... class Task(asyncio.Task): ... class SubClass(Task, Future): ... ``` `asyncio.Task` is a subclass of `asyncio.Future`, so these bases can coexist in the same MRO. But before, we ended up doing a comparison like `Task[Unknown] <: Future[Unknown]`, which I believe ends up failing because `Unknown <: Unknown` is false under subtyping?
Author
Parents
Loading