diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-08 00:01:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 00:01:56 (GMT) |
commit | a15e260b708a98edaba86a2aa663c3f6b2abc964 (patch) | |
tree | ac80e678c0266db42f8264a1fccfdeb1f58f6a17 /Objects/tupleobject.c | |
parent | 45ec5b99aefa54552947049086e87ec01bc2fc9a (diff) | |
download | cpython-a15e260b708a98edaba86a2aa663c3f6b2abc964.zip cpython-a15e260b708a98edaba86a2aa663c3f6b2abc964.tar.gz cpython-a15e260b708a98edaba86a2aa663c3f6b2abc964.tar.bz2 |
bpo-40170: Add _PyIndex_Check() internal function (GH-19426)
Add _PyIndex_Check() function to the internal C API: fast inlined
verson of PyIndex_Check().
Add Include/internal/pycore_abstract.h header file.
Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects
and Python subdirectories.
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 68163d8..110c092 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -2,6 +2,7 @@ /* Tuple object implementation */ #include "Python.h" +#include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_object.h" #include "pycore_pystate.h" #include "pycore_accu.h" @@ -763,7 +764,7 @@ static PySequenceMethods tuple_as_sequence = { static PyObject* tuplesubscript(PyTupleObject* self, PyObject* item) { - if (PyIndex_Check(item)) { + if (_PyIndex_Check(item)) { Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) return NULL; |