JelleZijlstra · GitHub

Bug report

Bug description:

This code (from https://discuss.python.org/t/type-object-cls-has-no-attribute-parameters/104276/4 ):

class Base:
    def __init_subclass__(cls) -> None:
        pass
class Sub[T](Base): pass
class SubSub(Sub[object]): pass

Fails with an inscrutable error about cls.__parameters__ not existing, because super().__init_subclass__() was not called.

Let's produce a clearer error message in this case so it's easier to debug for the next person.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Read the original on github.com ↗