diff options
author | Sam Gross <colesbury@gmail.com> | 2024-02-02 13:03:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-02 13:03:15 (GMT) |
commit | d0f1307580a69372611d27b04bbf2551dc85a1ef (patch) | |
tree | c690e6915eb44d57fc8af1623dc57babe3eca3ab /Include | |
parent | 0e71a295e9530c939a5efcb45db23cf31e0303b4 (diff) | |
download | cpython-d0f1307580a69372611d27b04bbf2551dc85a1ef.zip cpython-d0f1307580a69372611d27b04bbf2551dc85a1ef.tar.gz cpython-d0f1307580a69372611d27b04bbf2551dc85a1ef.tar.bz2 |
gh-114329: Add `PyList_GetItemRef` function (GH-114504)
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns
a strong reference instead of a borrowed reference. Additionally, if the
passed "list" object is not a list, the function sets a `TypeError`
instead of calling `PyErr_BadInternalCall()`.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/listobject.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/listobject.h b/Include/listobject.h index 6b7041b..4e4084b 100644 --- a/Include/listobject.h +++ b/Include/listobject.h @@ -29,6 +29,7 @@ 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); +PyAPI_FUNC(PyObject *) PyList_GetItemRef(PyObject *, Py_ssize_t); 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 *); |