diff options
author | Donghee Na <donghee.na@python.org> | 2024-07-16 01:16:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-16 01:16:41 (GMT) |
commit | 2bac2b86b1486f15038fb246835e04bb1b213cd8 (patch) | |
tree | 78bf41eef3e1acd62e71fe99a6ac96a2833154bc | |
parent | 498a94c198e72525b8a7f4cb4f4a8957560f593a (diff) | |
download | cpython-2bac2b86b1486f15038fb246835e04bb1b213cd8.zip cpython-2bac2b86b1486f15038fb246835e04bb1b213cd8.tar.gz cpython-2bac2b86b1486f15038fb246835e04bb1b213cd8.tar.bz2 |
gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626)
-rw-r--r-- | Doc/c-api/list.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst index 53eb54d..758415a 100644 --- a/Doc/c-api/list.rst +++ b/Doc/c-api/list.rst @@ -38,9 +38,12 @@ List Objects .. note:: If *len* is greater than zero, the returned list object's items are - set to ``NULL``. Thus you cannot use abstract API functions such as - :c:func:`PySequence_SetItem` or expose the object to Python code before - setting all items to a real object with :c:func:`PyList_SetItem`. + set to ``NULL``. Thus you cannot use abstract API functions such as + :c:func:`PySequence_SetItem` or expose the object to Python code before + setting all items to a real object with :c:func:`PyList_SetItem` or + :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before + the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`. + .. c:function:: Py_ssize_t PyList_Size(PyObject *list) |