-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C API #111508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ted C API In the limited C API version 3.13, Py_SET_REFCNT() function is now implemented as an opaque function call. Add _Py_SetRefcnt() to the stable ABI.
67638c4
to
ac0c1dd
Compare
Why is this particular function necessary?
|
It's needed to be able to remove non-portable assembly code from The code was just change for free threading. This change follows Py_INCREF/DECREF which already use an opaque function call in limited C API version 3.12. |
I also have concerns about that. But this change is a practical change to make the situation less bad. I plan to work on a whole PEP to disallow accessing directly PyObject.ob_refcnt and convert more functions to opaque function calls in the limited C API, as Sam describes in the issue. |
@colesbury @serhiy-storchaka @erlend-aasland: Would you mind to review this change? |
I'll leave this to @colesbury. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think this only improves our compatibility story going forward. We have already committed to this functionality as part of the API and ABI. Using an opaque function instead of an inline function does not change this.
+1 API-wise -- keeping it |
Merged, thanks for reviews. |
|
…ted C API (python#111508) In the limited C API version 3.13, Py_SET_REFCNT() function is now implemented as an opaque function call. Add _Py_SetRefcnt() to the stable ABI.
…ted C API (python#111508) In the limited C API version 3.13, Py_SET_REFCNT() function is now implemented as an opaque function call. Add _Py_SetRefcnt() to the stable ABI.
In the limited C API version 3.13, Py_SET_REFCNT() function is now implemented as an opaque function call.
Add _Py_SetRefcnt() to the stable ABI.
--disable-gil
builds are not compatible with the limited API #111506