From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:32:31 +0000 (+0200) Subject: [3.13] gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626... X-Git-Tag: v3.13.0b4~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e64a9db73dd51c72064ef462b19146e9b9419633;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626) (gh-121827) gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626) (cherry picked from commit 2bac2b86b1486f15038fb246835e04bb1b213cd8) Co-authored-by: Donghee Na --- diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst index 53eb54d3e102..758415a76e5c 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)