These new API functions are needed for Numpy/HPy. I recommend reviewing commit by commit.
The equivalent functions in CPython take PyTypeObject * as arguments which we cannot do in HPy but as we already do with HPy_TypeCheck, we check that in the debug mode.
In case of HPyType_GetName, I decided to return the type's name as a UTF-8 encoded C string instead of returning a Unicode object as CPython does. Reason: If a C extension wants to retrieve the name of a type, I assume it will work with the name in C. Also, there is a perfect option to get the type's name as Unicode object, which is: HPy_GetAttr_s(ctx, type, "__name__").
This PR also contains a little doc improvement: The HPy API function index is now sorted alphabetically.
These new API functions are needed for Numpy/HPy. I recommend reviewing commit by commit.
The equivalent functions in CPython take
PyTypeObject *
as arguments which we cannot do in HPy but as we already do withHPy_TypeCheck
, we check that in the debug mode.In case of
HPyType_GetName
, I decided to return the type's name as a UTF-8 encoded C string instead of returning a Unicode object as CPython does. Reason: If a C extension wants to retrieve the name of a type, I assume it will work with the name in C. Also, there is a perfect option to get the type's name as Unicode object, which is:HPy_GetAttr_s(ctx, type, "__name__")
.This PR also contains a little doc improvement: The HPy API function index is now sorted alphabetically.