-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-89653: PEP 670: Convert PyBytes macros to functions #91990
Conversation
Include/cpython/bytearrayobject.h
Outdated
#define _PyByteArray_CAST(op) \ | ||
(assert(PyByteArray_Check(op)), \ | ||
_Py_reinterpret_cast(PyByteArrayObject*, op)) |
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.
Why not write this out in the static inline functions? Ditto for _PyBytes_CAST
.
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.
The purpose of this macro is to cast to PyByteArrayObject*
. If it's converted to a function, what would be the argument type? How do you prevent introducing new compiler warnings?
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.
Ok, this is fine.
Convert the following macros to static inline functions: * PyByteArray_AS_STRING() * PyByteArray_GET_SIZE() * PyBytes_AS_STRING() * PyBytes_GET_SIZE() Limited C API version 3.11 no longer casts arguments. Add _PyBytes_CAST() and _PyByteArray_CAST() macros.
I rebased my PR to get the renamed |
Thanks for the review @erlend-aasland. |
Convert the following macros to static inline functions:
Limited C API version 3.11 no longer casts arguments.
Add _PyBytes_CAST() and _PyByteArray_CAST() macros.