When run in test_hpytype.py then @DEFAULT_SHAPE is an empty comment "/* default object shape */" and everything is fine. But when these tests are rerun in test_hpytype_legacy.py, then @DEFAULT_SHAPE becomes .builtin_shape = HPyType_BuiltinShape_Legacy.
As I understand the intention of using the legacy shape is that the type can be used via the C-API, so it needs to become a heap type object. But the preamble to add #include <Python.h> is missing, and the basicsize is 0 (not declared). I guess I can work around the missing include file somehow, but it is not clear to me if a type spec can declare legacy shape without declaring a basicsize. Thoughts? Should this Just Work (i.e. when creating a type from the spec, note the legacy flag and allocate a heap type object as the storage)?
The code in
test_htype.py
has tests likeWhen run in
test_hpytype.py
then@DEFAULT_SHAPE
is an empty comment"/* default object shape */"
and everything is fine. But when these tests are rerun intest_hpytype_legacy.py
, then@DEFAULT_SHAPE
becomes.builtin_shape = HPyType_BuiltinShape_Legacy
.As I understand the intention of using the legacy shape is that the type can be used via the C-API, so it needs to become a heap type object. But the preamble to add
#include <Python.h>
is missing, and thebasicsize
is 0 (not declared). I guess I can work around the missing include file somehow, but it is not clear to me if a type spec can declare legacy shape without declaring a basicsize. Thoughts? Should this Just Work (i.e. when creating a type from the spec, note the legacy flag and allocate a heap type object as the storage)?