Add tests for using PEP560 with classes implemented in C. by serhiy-storchaka · Pull Request #4883 · python/cpython
Thank you for adding these tests! I just have one suggestion to make the test closer to how these methods will be used in typical code. The idea is that there will be typically a pair of classes:
class Generic: def __class_getitem__(cls, item): return GenericAlias(item) class GenericAlias: def __init__(self, item): self.item = item def __mro_entries__(self, bases): return (item,)
but this is just a minor suggestion, you can merge it as is if you prefer.