-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
[C API] Make Py_REFCNT() opaque in limited C API 3.14 #124127
Labels
Comments
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Sep 16, 2024
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Sep 16, 2024
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Sep 16, 2024
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
Sep 16, 2024
Previous issue about Py_TYPE(): #120600 |
vstinner
added a commit
that referenced
this issue
Sep 24, 2024
Implemented in 9d344fa. |
Functions implemented as opaque function calls in limited C API 3.14:
Py_SET_TYPE() is not implemented as an opaque function call since it should not be used in the limited C API, it's only useful with static types. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the limited C API 3.14 and newer, I propose to change Py_REFCNT() implementation to an opaque function call to hide implementation details. I made a similar change for Py_INCREF() and Py_DECREF() in Python 3.12.
The problem is that with Free Threading (PEP 703), the implementation of this functions becomes less trivial than just getting the object member
PyObject.ob_refcnt
:_Py_atomic_load_uint32_relaxed()
and_Py_atomic_load_ssize_relaxed()
must now be called. But I would prefer to not "leak" such implementation detail into the limited C API.cc @colesbury @Fidget-Spinner @encukou
Linked PRs
The text was updated successfully, but these errors were encountered: