New submission from Christian Tismer <tis...@stackless.com>:

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.

----------
components: Extension Modules
messages: 318436
nosy: Christian.Tismer, larry, ned.deily
priority: release blocker
severity: normal
status: open
title: PyIndex_Check conflicts with PEP 384
type: compile error
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33738>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to