bpo-40170: Remove PyIndex_Check() macro (GH-19428)
Always declare PyIndex_Check() as an opaque function to hide implementation details: remove PyIndex_Check() macro. The macro accessed directly the PyTypeObject.tp_as_number member.
This commit is contained in:
parent
a15e260b70
commit
307b9d0144
|
@ -335,12 +335,6 @@ PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
|
||||||
(Py_TYPE(obj)->tp_iternext != NULL && \
|
(Py_TYPE(obj)->tp_iternext != NULL && \
|
||||||
Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented)
|
Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented)
|
||||||
|
|
||||||
/* === Number Protocol ================================================== */
|
|
||||||
|
|
||||||
#define PyIndex_Check(obj) \
|
|
||||||
(Py_TYPE(obj)->tp_as_number != NULL && \
|
|
||||||
Py_TYPE(obj)->tp_as_number->nb_index != NULL)
|
|
||||||
|
|
||||||
/* === Sequence protocol ================================================ */
|
/* === Sequence protocol ================================================ */
|
||||||
|
|
||||||
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
|
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Always declare :c:func:`PyIndex_Check` as an opaque function to hide
|
||||||
|
implementation details: remove ``PyIndex_Check()`` macro. The macro accessed
|
||||||
|
directly the :c:member:`PyTypeObject.tp_as_number` member.
|
|
@ -1309,8 +1309,6 @@ PyNumber_Absolute(PyObject *o)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#undef PyIndex_Check
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PyIndex_Check(PyObject *obj)
|
PyIndex_Check(PyObject *obj)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue