summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/list.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-10-26 19:59:18 (GMT)
committerGitHub <noreply@github.com>2019-10-26 19:59:18 (GMT)
commitd898d20e8c228229eb68e545f544db13f246f216 (patch)
tree61c483b605b6dc9ae241764630ff5a4c1051dd7d /Doc/c-api/list.rst
parent26ae9f6d3d755734c9f371b9356325afe5764813 (diff)
downloadcpython-d898d20e8c228229eb68e545f544db13f246f216.zip
cpython-d898d20e8c228229eb68e545f544db13f246f216.tar.gz
cpython-d898d20e8c228229eb68e545f544db13f246f216.tar.bz2
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
Diffstat (limited to 'Doc/c-api/list.rst')
-rw-r--r--Doc/c-api/list.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst
index dc90266..646f29d 100644
--- a/Doc/c-api/list.rst
+++ b/Doc/c-api/list.rst
@@ -71,8 +71,9 @@ List Objects
.. c:function:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)
- Set the item at index *index* in list to *item*. Return ``0`` on success
- or ``-1`` on failure.
+ Set the item at index *index* in list to *item*. Return ``0`` on success.
+ If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError`
+ exception.
.. note::
@@ -111,8 +112,7 @@ List Objects
Return a list of the objects in *list* containing the objects *between* *low*
and *high*. Return *NULL* and set an exception if unsuccessful. Analogous
- to ``list[low:high]``. Negative indices, as when slicing from Python, are not
- supported.
+ to ``list[low:high]``. Indexing from the end of the list is not supported.
.. c:function:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist)
@@ -120,8 +120,8 @@ List Objects
Set the slice of *list* between *low* and *high* to the contents of
*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may
be *NULL*, indicating the assignment of an empty list (slice deletion).
- Return ``0`` on success, ``-1`` on failure. Negative indices, as when
- slicing from Python, are not supported.
+ Return ``0`` on success, ``-1`` on failure. Indexing from the end of the
+ list is not supported.
.. c:function:: int PyList_Sort(PyObject *list)