Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-139165: Make Py_SIZE, Py_IS_TYPE,Py_ SET_SIZE regular functions in stable ABI#139166
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
1bb08c29270e960ee604ab5b8c1eb522757eebcc12aee27c90306b577028056File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Expose the functions :c:func:`Py_SIZE`, :c:func:`Py_IS_TYPE` and | ||
| :c:func:`Py_SET_SIZE` in the Stable ABI. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3361,24 +3361,6 @@ Py_GetConstantBorrowed(unsigned int constant_id) | ||
| return Py_GetConstant(constant_id); | ||
| } | ||
| // Py_TYPE() implementation for the stable ABI | ||
| #undef Py_TYPE | ||
| PyTypeObject* | ||
| Py_TYPE(PyObject *ob) | ||
| { | ||
| return _Py_TYPE(ob); | ||
| } | ||
| // Py_REFCNT() implementation for the stable ABI | ||
| #undef Py_REFCNT | ||
| Py_ssize_t | ||
| Py_REFCNT(PyObject *ob) | ||
| { | ||
| return _Py_REFCNT(ob); | ||
| } | ||
| int | ||
| PyUnstable_IsImmortal(PyObject *op) | ||
| { | ||
| @@ -3405,3 +3387,16 @@ _PyObject_VisitType(PyObject *op, visitproc visit, void *arg) | ||
| Py_VISIT(tp); | ||
| return 0; | ||
| } | ||
| // Implementations for the stable ABI | ||
| // Keep these at the end. | ||
| #undef Py_TYPE | ||
| #undef Py_REFCNT | ||
| #undef Py_SIZE | ||
| #undef Py_IS_TYPE | ||
| #undef Py_SET_SIZE | ||
| PyTypeObject* Py_TYPE(PyObject *ob) { return _Py_TYPE_impl(ob); } | ||
| Py_ssize_t Py_REFCNT(PyObject *ob) { return _Py_REFCNT(ob); } | ||
| Py_ssize_t Py_SIZE(PyObject *o) { return _Py_SIZE_impl(o); } | ||
| int Py_IS_TYPE(PyObject *o, PyTypeObject *t) { return _Py_IS_TYPE_impl(o, t); } | ||
| void Py_SET_SIZE(PyVarObject *o, Py_ssize_t s) { _Py_SET_SIZE_impl(o, s); } | ||
encukou marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm just checking PyO3's FFI definitions against 3.15b1 and it seems to me that this PR has changed these symbols to always be exported functions on 3.15.
That seems to differ with the issue description, which apparently intended to keep the static inline functions for the non-limited API?
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.
Extract of object.c in the 3.15 branch:
If Py_LIMITED_API is not defined or if it's defined to Python 3.14 or older, Py_IS_TYPE() is implemented as a static inline function. The code has been modified since this PR.
Would you mind to elaborate which API is implemented as a function call? Using the limited C API or not? Which limited C API version?
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.
You're right, sorry for the confusion. I think the tooling I was using to check had a bug, and then I saw this diff and got myself confused. 🤦
Even looking at this diff again, the
#definemacros just below starting on 292 will implement as a static inline function.Sorry for the noise!
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.
No problem. Thanks for double checking.