Author Christian.Tismer
Recipients Christian.Tismer, larry, ned.deily
Date 2018-06-01.17:14:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The file number.rst on python 3.6 says

.. c:function:: int PyIndex_Check(PyObject *o)

   Returns ``1`` if *o* is an index integer (has the nb_index slot of the
   tp_as_number structure filled in), and ``0`` otherwise.

But in reality, this is a macro:

#define PyIndex_Check(obj) \
   ((obj)->ob_type->tp_as_number != NULL && \
    (obj)->ob_type->tp_as_number->nb_index != NULL)

But such a macro does not work with the limited API, since
non-heaptypes cannot use PyType_GetSlot.

The patch is trivial: Define the function instead of the macro
when Py_LIMITED_API is set.

I also think the documentation makes more sense when it is correct.
Date User Action Args
2018-06-01 17:14:59Christian.Tismersetrecipients: + Christian.Tismer, larry, ned.deily
2018-06-01 17:14:59Christian.Tismersetmessageid: <>
2018-06-01 17:14:58Christian.Tismerlinkissue33738 messages
2018-06-01 17:14:58Christian.Tismercreate