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 /Python/ceval.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 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d79a239..7747b08 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -10,6 +10,7 @@ #define PY_LOCAL_AGGRESSIVE #include "Python.h" +#include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_call.h" #include "pycore_ceval.h" #include "pycore_code.h" @@ -5089,7 +5090,7 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi) PyThreadState *tstate = _PyThreadState_GET(); if (v != Py_None) { Py_ssize_t x; - if (PyIndex_Check(v)) { + if (_PyIndex_Check(v)) { x = PyNumber_AsSsize_t(v, NULL); if (x == -1 && _PyErr_Occurred(tstate)) return 0; @@ -5110,7 +5111,7 @@ _PyEval_SliceIndexNotNone(PyObject *v, Py_ssize_t *pi) { PyThreadState *tstate = _PyThreadState_GET(); Py_ssize_t x; - if (PyIndex_Check(v)) { + if (_PyIndex_Check(v)) { x = PyNumber_AsSsize_t(v, NULL); if (x == -1 && _PyErr_Occurred(tstate)) return 0; |