where _HPy_AsStruct_Legacy for CPython is _h2py(h). But the h in the test is the Dummy type object, not the DummyMeta type object, so doesn't _h2py(h) return the Dummy data struct (and not the DummyMeta struct the test is expecting? In universal mode, DummyMeta_AsStruct calls _HPy_AsStruct_Type, which I wrote as obj = handles.deref(h); type = type(obj); return dataptr(type) so that it will return the DummyMeta struct, but I don't know what to do for _HPy_AsStruct_Legacy.
In
test_metaclass
there is this code: https://github.com/hpyproject/hpy/blob/f6114734b4a5d03cfb9d24d3e8c71f77e8803881/test/test_hpytype.py#L1462It calls into this function: https://github.com/hpyproject/hpy/blob/f6114734b4a5d03cfb9d24d3e8c71f77e8803881/test/test_hpytype.py#L244-L254
In legacy mode the macro
DummyMeta_AsStruct
is converted intowhere
_HPy_AsStruct_Legacy
for CPython is_h2py(h)
. But theh
in the test is theDummy
type object, not theDummyMeta
type object, so doesn't_h2py(h)
return theDummy
data struct (and not theDummyMeta
struct the test is expecting? In universal mode,DummyMeta_AsStruct
calls_HPy_AsStruct_Type
, which I wrote asobj = handles.deref(h); type = type(obj); return dataptr(type)
so that it will return theDummyMeta
struct, but I don't know what to do for_HPy_AsStruct_Legacy
.