Skip to content

Commit f8709e8

Browse files
authored
bpo-37487: Fix PyList_GetItem index description. (GH-14623)
0 is a legal index.
1 parent fcf1d00 commit f8709e8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Doc/c-api/list.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ List Objects
5959
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
6060
6161
Return the object at position *index* in the list pointed to by *list*. The
62-
position must be positive, indexing from the end of the list is not
63-
supported. If *index* is out of bounds, return *NULL* and set an
64-
:exc:`IndexError` exception.
62+
position must be non-negative; indexing from the end of the list is not
63+
supported. If *index* is out of bounds (<0 or >=len(list)),
64+
return *NULL* and set an :exc:`IndexError` exception.
6565
6666
6767
.. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix PyList_GetItem index description to include 0.

0 commit comments

Comments
 (0)