summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-08 02:01:56 +0200
committerGitHub <noreply@github.com>2020-04-08 02:01:56 +0200
commita15e260b708a98edaba86a2aa663c3f6b2abc964 (patch)
treeac80e678c0266db42f8264a1fccfdeb1f58f6a17 /Objects/unicodeobject.c
parent45ec5b99aefa54552947049086e87ec01bc2fc9a (diff)
downloadcpython-git-a15e260b708a98edaba86a2aa663c3f6b2abc964.tar.gz
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/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index da17bfe01f..1e1f257dad 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -40,6 +40,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_bytes_methods.h"
#include "pycore_fileutils.h"
#include "pycore_initconfig.h"
@@ -14132,7 +14133,7 @@ unicode_subscript(PyObject* self, PyObject* item)
if (PyUnicode_READY(self) == -1)
return NULL;
- 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;