Skip to content

gh-121403: Add notes for PyList_GetXXX APIs about the need for init #121626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Doc/c-api/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ 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()`
- :c:func:`PyList_SET_ITEM()`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list is not rendered properly. Maybe just write: "The following ...: PyList_SetItem and PyList_SET_ITEM."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.




.. c:function:: Py_ssize_t PyList_Size(PyObject *list)
Expand Down
Loading