diff --git a/Include/listobject.h b/Include/listobject.h index 4e4084b4348..e1e059b0ba7 100644 --- a/Include/listobject.h +++ b/Include/listobject.h @@ -29,7 +29,9 @@ PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000 PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t); +#endif PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); diff --git a/Modules/_testlimitedcapi/heaptype_relative.c b/Modules/_testlimitedcapi/heaptype_relative.c index 7c508c6182b..c2531518d86 100644 --- a/Modules/_testlimitedcapi/heaptype_relative.c +++ b/Modules/_testlimitedcapi/heaptype_relative.c @@ -1,6 +1,6 @@ // Need limited C API version 3.12 for PyType_FromMetaclass() #include "pyconfig.h" // Py_GIL_DISABLED -#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API ) +#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) # define Py_LIMITED_API 0x030c0000 #endif diff --git a/Modules/_testlimitedcapi/list.c b/Modules/_testlimitedcapi/list.c index 3022cbf9191..ed492c3e719 100644 --- a/Modules/_testlimitedcapi/list.c +++ b/Modules/_testlimitedcapi/list.c @@ -1,3 +1,9 @@ +// Need limited C API version 3.13 for PyList_GetItemRef() +#include "pyconfig.h" // Py_GIL_DISABLED +#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) +# define Py_LIMITED_API 0x030d0000 +#endif + #include "parts.h" #include "util.h" diff --git a/Modules/_testlimitedcapi/object.c b/Modules/_testlimitedcapi/object.c index 6e438c811d6..da6fe3e4efa 100644 --- a/Modules/_testlimitedcapi/object.c +++ b/Modules/_testlimitedcapi/object.c @@ -1,6 +1,6 @@ // Need limited C API version 3.13 for Py_GetConstant() #include "pyconfig.h" // Py_GIL_DISABLED -#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API ) +#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) # define Py_LIMITED_API 0x030d0000 #endif diff --git a/Modules/_testlimitedcapi/parts.h b/Modules/_testlimitedcapi/parts.h index d91f174cd31..d5e590a8dcd 100644 --- a/Modules/_testlimitedcapi/parts.h +++ b/Modules/_testlimitedcapi/parts.h @@ -7,7 +7,7 @@ #include "pyconfig.h" // Py_GIL_DISABLED // Use the limited C API -#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API ) +#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) // need limited C API version 3.5 for PyModule_AddFunctions() # define Py_LIMITED_API 0x03050000 #endif diff --git a/Modules/_testlimitedcapi/vectorcall_limited.c b/Modules/_testlimitedcapi/vectorcall_limited.c index 784126c17fc..5ef97ca8a06 100644 --- a/Modules/_testlimitedcapi/vectorcall_limited.c +++ b/Modules/_testlimitedcapi/vectorcall_limited.c @@ -2,7 +2,7 @@ // Need limited C API version 3.12 for PyObject_Vectorcall() #include "pyconfig.h" // Py_GIL_DISABLED -#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API ) +#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) # define Py_LIMITED_API 0x030c0000 #endif