Skip to content

Commit 2057c92

Browse files
authored
gh-114329: Fix PyList_GetItemRef() limited C API definition (#117520)
1 parent c43f6a4 commit 2057c92

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

Include/listobject.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
2929
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
3030

3131
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
32+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
3233
PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t);
34+
#endif
3335
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
3436
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
3537
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);

Modules/_testlimitedcapi/heaptype_relative.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Need limited C API version 3.12 for PyType_FromMetaclass()
22
#include "pyconfig.h" // Py_GIL_DISABLED
3-
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
3+
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
44
# define Py_LIMITED_API 0x030c0000
55
#endif
66

Modules/_testlimitedcapi/list.c

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Need limited C API version 3.13 for PyList_GetItemRef()
2+
#include "pyconfig.h" // Py_GIL_DISABLED
3+
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
4+
# define Py_LIMITED_API 0x030d0000
5+
#endif
6+
17
#include "parts.h"
28
#include "util.h"
39

Modules/_testlimitedcapi/object.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Need limited C API version 3.13 for Py_GetConstant()
22
#include "pyconfig.h" // Py_GIL_DISABLED
3-
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
3+
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
44
# define Py_LIMITED_API 0x030d0000
55
#endif
66

Modules/_testlimitedcapi/parts.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "pyconfig.h" // Py_GIL_DISABLED
88

99
// Use the limited C API
10-
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
10+
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
1111
// need limited C API version 3.5 for PyModule_AddFunctions()
1212
# define Py_LIMITED_API 0x03050000
1313
#endif

Modules/_testlimitedcapi/vectorcall_limited.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Need limited C API version 3.12 for PyObject_Vectorcall()
44
#include "pyconfig.h" // Py_GIL_DISABLED
5-
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API )
5+
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API)
66
# define Py_LIMITED_API 0x030c0000
77
#endif
88

0 commit comments

Comments
 (0)