Return whether a type is a disjoint base at runtime, mirroring CPython's logic in typeobject.c. See PEP 800.
(typ: type[object])
| 537 | |
| 538 | |
| 539 | def _is_disjoint_base(typ: type[object]) -> bool: |
| 540 | """Return whether a type is a disjoint base at runtime, mirroring CPython's logic in typeobject.c. |
| 541 | |
| 542 | See PEP 800.""" |
| 543 | if typ is object: |
| 544 | return True |
| 545 | base = typ.__base__ |
| 546 | assert base is not None, f"Type {typ} has no base" |
| 547 | return _shape_differs(typ, base) |
| 548 | |
| 549 | |
| 550 | def _verify_disjoint_base( |
no test coverage detected
searching dependent graphs…