hpyproject / hpy

HPy: a better API for Python

Home Page:https://hpyproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Properly handle pure HPy types extending from a custom legacy type.

fangerer opened this issue · comments

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.

I expect that this does not affect the ABI but just the implementation. So, I'm removing this from the ABI version 1 milestone.