Skip to content

Commit 2bac2b8

Browse files
authored
gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626)
1 parent 498a94c commit 2bac2b8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Doc/c-api/list.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ List Objects
3838
.. note::
3939
4040
If *len* is greater than zero, the returned list object's items are
41-
set to ``NULL``. Thus you cannot use abstract API functions such as
42-
:c:func:`PySequence_SetItem` or expose the object to Python code before
43-
setting all items to a real object with :c:func:`PyList_SetItem`.
41+
set to ``NULL``. Thus you cannot use abstract API functions such as
42+
:c:func:`PySequence_SetItem` or expose the object to Python code before
43+
setting all items to a real object with :c:func:`PyList_SetItem` or
44+
:c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before
45+
the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`.
46+
4447
4548
4649
.. c:function:: Py_ssize_t PyList_Size(PyObject *list)

0 commit comments

Comments
 (0)