summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-07-06 21:54:56 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2019-07-06 21:54:56 (GMT)
commitad3720359faa933d04bde3d3222fd54e73ee7feb (patch)
treea1a3491a469f3f4f81e660ac420644130479408c
parentd4af55391f56286ab8d478591017174a5a0a5ce2 (diff)
downloadcpython-ad3720359faa933d04bde3d3222fd54e73ee7feb.zip
cpython-ad3720359faa933d04bde3d3222fd54e73ee7feb.tar.gz
cpython-ad3720359faa933d04bde3d3222fd54e73ee7feb.tar.bz2
bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14624)
0 is a legal index. (cherry picked from commit f8709e804d16ec5d44b1d2f00d59a0f78df7b792) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
-rw-r--r--Doc/c-api/list.rst6
-rw-r--r--Misc/NEWS.d/next/Documentation/2019-07-06-17-19-26.bpo-37487.QagfZ5.rst1
2 files changed, 4 insertions, 3 deletions
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst
index 279783a..dc90266 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 0000000..605d08c
--- /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.