Skip to content

Commit

Permalink
add tp-traverse to dtype_legacy_defines
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Dec 7, 2023
1 parent 47ab51b commit 37986b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions numpy/core/src/multiarray/dtypemeta.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ legacy_dtype_default_new_impl(HPyContext *ctx, HPy h_self,
return HPyField_Load(ctx, h_self, self->singleton);
}

HPyDef_SLOT(legacy_dtype_tp_traverse, HPy_tp_traverse)
static int legacy_dtype_tp_traverse_impl(void *self_p, HPyFunc_visitproc visit, void *arg) {
PyArray_Descr *self = (PyArray_Descr*) self_p;
if (&self->typeobj)
HPy_VISIT(&self->typeobj);
if (&self->names)
HPy_VISIT(&self->names);
return 0;
}

//static PyArray_Descr *
//nonparametric_discover_descr_from_pyobject(
Expand Down Expand Up @@ -599,6 +608,7 @@ hpy_object_common_dtype(HPyContext *ctx, HPy /* PyArray_DTypeMeta * */ cls,

static HPyDef *new_dtype_legacy_defines[] = {
&legacy_dtype_default_new,
&legacy_dtype_tp_traverse,
NULL
};
static HPyType_Spec New_PyArrayDescr_spec_prototype = {
Expand Down

0 comments on commit 37986b0

Please sign in to comment.