Python C API: how to mark a type as subclass of another type

Dieter Maurer dieter at handshake.de
Mon Nov 1 12:18:43 EDT 2021


Marco Sulla wrote at 2021-10-31 23:59 +0100:
>I have two types declared as
>
>PyTypeObject PyX_Type = {
>    PyVarObject_HEAD_INIT(&PyType_Type, 0)
>
>etc.
>
>How can I mark one of the types as subclass of the other one? I tried
>to use tp_base but it didn't work.

Read the "Python/C Api" documentation. Watch out for `tp_base`.


More information about the Python-list mailing list