mirror of
https://github.com/python/cpython.git
synced 2026-02-09 11:21:00 +00:00
gh-89653: PEP 670: Macros always cast arguments in cpython/ (#93766)
Header files in the Include/cpython/ are only included if the Py_LIMITED_API macro is not defined.
This commit is contained in:
parent
c2007573dd
commit
df22eec421
9 changed files with 28 additions and 92 deletions
|
|
@ -23,9 +23,7 @@ static inline Py_ssize_t PyTuple_GET_SIZE(PyObject *op) {
|
|||
PyTupleObject *tuple = _PyTuple_CAST(op);
|
||||
return Py_SIZE(tuple);
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
# define PyTuple_GET_SIZE(op) PyTuple_GET_SIZE(_PyObject_CAST(op))
|
||||
#endif
|
||||
#define PyTuple_GET_SIZE(op) PyTuple_GET_SIZE(_PyObject_CAST(op))
|
||||
|
||||
#define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index])
|
||||
|
||||
|
|
@ -35,9 +33,7 @@ PyTuple_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
|
|||
PyTupleObject *tuple = _PyTuple_CAST(op);
|
||||
tuple->ob_item[index] = value;
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
#define PyTuple_SET_ITEM(op, index, value) \
|
||||
PyTuple_SET_ITEM(_PyObject_CAST(op), index, _PyObject_CAST(value))
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue