hpy
hpy copied to clipboard
Properly handle pure HPy types extending from a custom legacy type.
This is related to issue #169 .
Although it is possible for pure types to extend any legacy type (in the sense that at the time of type creation, HPy won't raise an error), it is actually not supported. Using the <type_struct>_AsStruct
function will most likely return the wrong pointer.
This is maybe something HPy should prevent by default. However, it might still make sense to allow it since one can use _HPyType_GetBuiltinShape
to get the shape of the base type to determine if it is a legacy type and then it is possible to implement a custom *_AsStruct
by manually adding the base's basicsize.
Since that is pretty complicated and error prone, I think HPy should either disallow it or properly support it.