Skip to content

C API: Add PyTuple_GetItemRef(), similar to PyTuple_GetItem() but return a strong reference #117518

@vstinner

Description

@vstinner

I propose to add a new PyTuple_GetItemRef() function, similar to PyTuple_GetItem() but return a strong reference instead of a borrowed reference.

Other functions were added recently to return a strong reference:

I already proposed adding PyTuple_GetItemRef() in 2020, but the idea was rejected: issue gh-86460. Since 2020, Free Threading (PEP 703) was added to Python and borrowed references don't play well with Free Threading.

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