Skip to content

Commit

Permalink
pythongh-121403: Add notes for PyList_GetXXX APIs about the need for …
Browse files Browse the repository at this point in the history
…init
  • Loading branch information
corona10 committed Jul 11, 2024
1 parent 58e8cf2 commit cba65de
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Doc/c-api/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,29 @@ List Objects
.. versionadded:: 3.13
.. note::
You can not use this function until all items are set to real objects
with :c:func:`PyList_SetItem` or :c:func:`PyList_SET_ITEM`.
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
Like :c:func:`PyList_GetItemRef`, but returns a
:term:`borrowed reference` instead of a :term:`strong reference`.
.. note::
You can not use this function until all items are set to real objects
with :c:func:`PyList_SetItem` or :c:func:`PyList_SET_ITEM`.
.. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
Similar to :c:func:`PyList_GetItem`, but without error checking.
.. note::
You can not use this function until all items are set to real objects
with :c:func:`PyList_SetItem` or :c:func:`PyList_SET_ITEM`.
.. c:function:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)
Expand Down

0 comments on commit cba65de

Please sign in to comment.