Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding an unstable C API for unique references #133140

Closed
@ZeroIntensity

Description

@ZeroIntensity

Feature or enhancement

Proposal:

In#132070, there was a race brought up in free-threading through use ofPy_REFCNT(op) == 1. The fix is to use_PyObject_IsUniquelyReferenced.

There were a couple additional comments about how we should handle this for the public API (for example,@godlygeek suggested implementingPy_REFCNT as_PyObject_IsUniquelyReferenced(op) ? 1 : INT_MAX). I think the best approach is to just expose an unstable API for this and point to it inPy_REFCNT's documentation.

I'm not imagining anything complex:

intPyUnstable_Object_IsUniquelyReferenced(PyObject*op){return_PyObject_IsUniquelyReferenced(op);}

@encukou, do you mind if this skips the C API WG? I'm not sure there's much to discuss about the API, other than some light bikeshedding.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp