mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-89653: PEP 670: Use PyObject* type for parameters (#92694)
Use the PyObject* type for parameters of static inline functions: * Py_SIZE(): same parameter type than PyObject_Size() * PyList_GET_SIZE(), PyList_SET_ITEM(): same parameter type than PyList_Size() and PyList_SetItem() * PyTuple_GET_SIZE(), PyTuple_SET_ITEM(): same parameter type than PyTuple_Size() and PyTuple_SetItem().
This commit is contained in:
parent
d492f0ab2a
commit
6de78ef96a
3 changed files with 20 additions and 15 deletions
|
|
@ -137,11 +137,12 @@ static inline PyTypeObject* Py_TYPE(PyObject *ob) {
|
|||
#endif
|
||||
|
||||
// bpo-39573: The Py_SET_SIZE() function must be used to set an object size.
|
||||
static inline Py_ssize_t Py_SIZE(PyVarObject *ob) {
|
||||
return ob->ob_size;
|
||||
static inline Py_ssize_t Py_SIZE(PyObject *ob) {
|
||||
PyVarObject *var_ob = _PyVarObject_CAST(ob);
|
||||
return var_ob->ob_size;
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
# define Py_SIZE(ob) Py_SIZE(_PyVarObject_CAST(ob))
|
||||
# define Py_SIZE(ob) Py_SIZE(_PyObject_CAST(ob))
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue