[Python-checkins] bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14625)

Terry Jan Reedy webhook-mailer at python.org
Sat Jul 6 17:55:23 EDT 2019


https://github.com/python/cpython/commit/9c930d076a7225694b369d30636a29acb556c2be
commit: 9c930d076a7225694b369d30636a29acb556c2be
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Terry Jan Reedy <tjreedy at udel.edu>
date: 2019-07-06T17:55:19-04:00
summary:

bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14625)

0 is a legal index.
(cherry picked from commit f8709e804d16ec5d44b1d2f00d59a0f78df7b792)

Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>

files:
A Misc/NEWS.d/next/Documentation/2019-07-06-17-19-26.bpo-37487.QagfZ5.rst
M Doc/c-api/list.rst

diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst
index 5b263a7b1cdf..a5cd634a454a 100644
--- a/Doc/c-api/list.rst
+++ b/Doc/c-api/list.rst
@@ -59,9 +59,9 @@ List Objects
 .. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
 
    Return the object at position *index* in the list pointed to by *list*.  The
-   position must be positive, indexing from the end of the list is not
-   supported.  If *index* is out of bounds, return *NULL* and set an
-   :exc:`IndexError` exception.
+   position must be non-negative; indexing from the end of the list is not
+   supported.  If *index* is out of bounds (<0 or >=len(list)),
+   return *NULL* and set an :exc:`IndexError` exception.
 
 
 .. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
diff --git a/Misc/NEWS.d/next/Documentation/2019-07-06-17-19-26.bpo-37487.QagfZ5.rst b/Misc/NEWS.d/next/Documentation/2019-07-06-17-19-26.bpo-37487.QagfZ5.rst
new file mode 100644
index 000000000000..605d08c3c040
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2019-07-06-17-19-26.bpo-37487.QagfZ5.rst
@@ -0,0 +1 @@
+Fix PyList_GetItem index description to include 0.



More information about the Python-checkins mailing list