Skip to content

Commit becde05

Browse files
terryjreedymiss-islington
authored andcommitted
bpo-37487: Fix PyList_GetItem index description. (pythonGH-14623)
0 is a legal index. (cherry picked from commit f8709e8) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent 55270d0 commit becde05

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Doc/c-api/list.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ List Objects
7676
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
7777
7878
Return the object at position *index* in the list pointed to by *list*. The
79-
position must be positive, indexing from the end of the list is not
80-
supported. If *index* is out of bounds, return *NULL* and set an
81-
:exc:`IndexError` exception.
79+
position must be non-negative; indexing from the end of the list is not
80+
supported. If *index* is out of bounds (<0 or >=len(list)),
81+
return *NULL* and set an :exc:`IndexError` exception.
8282
8383
.. versionchanged:: 2.5
8484
This function used an :c:type:`int` for *index*. This might require
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)