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.
diff --git a/Objects/interpreteridobject.c b/Objects/interpreteridobject.c
index 57748e8..3f31687 100644
--- a/Objects/interpreteridobject.c
+++ b/Objects/interpreteridobject.c
@@ -1,7 +1,8 @@
/* InterpreterID object */
#include "Python.h"
-#include "internal/pycore_pystate.h"
+#include "pycore_abstract.h" // _PyIndex_Check()
+#include "pycore_pystate.h"
#include "interpreteridobject.h"
@@ -42,7 +43,7 @@
if (PyObject_TypeCheck(arg, &_PyInterpreterID_Type)) {
id = ((interpid *)arg)->id;
}
- else if (PyIndex_Check(arg)) {
+ else if (_PyIndex_Check(arg)) {
id = PyLong_AsLongLong(arg);
if (id == -1 && PyErr_Occurred()) {
return 0;