Throughout the codebase, instances of mutable heap types must always implement the GC protocol to traverse their type. This leads to the following being repeated a lot:
static int
object_visit(PyObject *op, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(op));
return 0;
}
To reduce code duplication, I think it would be beneficial to have a common helper for this case. I'm going to call this _PyObject_VisitType for now.
cc @picnixz
Linked PRs