mirror of
https://github.com/python/cpython.git
synced 2025-09-03 15:31:08 +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
|
@ -40,9 +40,7 @@ PyAPI_DATA(PyTypeObject) PyCMethod_Type;
|
|||
static inline PyCFunction PyCFunction_GET_FUNCTION(PyObject *func) {
|
||||
return _PyCFunctionObject_CAST(func)->m_ml->ml_meth;
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
# define PyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(_PyObject_CAST(func))
|
||||
#endif
|
||||
#define PyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(_PyObject_CAST(func))
|
||||
|
||||
static inline PyObject* PyCFunction_GET_SELF(PyObject *func_obj) {
|
||||
PyCFunctionObject *func = _PyCFunctionObject_CAST(func_obj);
|
||||
|
@ -51,16 +49,12 @@ static inline PyObject* PyCFunction_GET_SELF(PyObject *func_obj) {
|
|||
}
|
||||
return func->m_self;
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
# define PyCFunction_GET_SELF(func) PyCFunction_GET_SELF(_PyObject_CAST(func))
|
||||
#endif
|
||||
#define PyCFunction_GET_SELF(func) PyCFunction_GET_SELF(_PyObject_CAST(func))
|
||||
|
||||
static inline int PyCFunction_GET_FLAGS(PyObject *func) {
|
||||
return _PyCFunctionObject_CAST(func)->m_ml->ml_flags;
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
# define PyCFunction_GET_FLAGS(func) PyCFunction_GET_FLAGS(_PyObject_CAST(func))
|
||||
#endif
|
||||
#define PyCFunction_GET_FLAGS(func) PyCFunction_GET_FLAGS(_PyObject_CAST(func))
|
||||
|
||||
static inline PyTypeObject* PyCFunction_GET_CLASS(PyObject *func_obj) {
|
||||
PyCFunctionObject *func = _PyCFunctionObject_CAST(func_obj);
|
||||
|
@ -69,6 +63,4 @@ static inline PyTypeObject* PyCFunction_GET_CLASS(PyObject *func_obj) {
|
|||
}
|
||||
return _Py_NULL;
|
||||
}
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
|
||||
# define PyCFunction_GET_CLASS(func) PyCFunction_GET_CLASS(_PyObject_CAST(func))
|
||||
#endif
|
||||
#define PyCFunction_GET_CLASS(func) PyCFunction_GET_CLASS(_PyObject_CAST(func))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue