Skip to content

__orig_bases__ returns indirect generic bases instead of direct bases, causing mismatch with __bases__ #137120

@chirizxc

Description

@chirizxc

Bug report

Bug description:

from abc import ABC, abstractmethod

class A[T](ABC):
    @abstractmethod
    async def get(self) -> T: ...

class B(A[int], ABC):
    @abstractmethod
    async def get_specific(self): ...

class C:
    pass

class D(C, B):
    async def get(self):
        return 1
    async def get_specific(self):
        return 2

print(D.__orig_bases__) # (__main__.A[int], <class 'abc.ABC'>)
print(D.__bases__)      # (<class '__main__.C'>, <class '__main__.B'>)

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions