Skip to content

Avoid boilerplate for traversing a mutable heap type #138342

@ZeroIntensity

Description

@ZeroIntensity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions