[issue33738] PyIndex_Check conflicts with PEP 384
Christian Tismer
report at bugs.python.org
Fri Jun 1 13:14:59 EDT 2018
New submission from Christian Tismer <tismer at 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 <report at bugs.python.org>
<https://bugs.python.org/issue33738>
_______________________________________
More information about the Python-bugs-list
mailing list