Skip to content

tp_dealloc example may need the trashcan for GC container types #158619

Description

@aeroyorch

Documentation

The tp_dealloc Complete Example has no trashcan, and calls PyObject_CallFinalizerFromDealloc() before anything else. A GC type whose instances can reference other instances of the same type recurses without bound if it follows that shape.

Since the macros Py_TRASHCAN_BEGIN / Py_TRASHCAN_END are not in the C API reference at all, that example is the natural thing to copy for a new GC type. Would a note there make sense, or is the trashcan deliberately out of scope for the ref docs? It is also not clear to me whether gh-124715 and gh-132280 already solve this from 3.14 on.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirpendingThe issue will be closed if no feedback is provided

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions