diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-07-06 14:55:41 -0700 |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2019-07-06 17:55:41 -0400 |
commit | dd3862e167d573b6e9a3348c365229ca958d1f1f (patch) | |
tree | 4529b24c90bf56fed692f0088a0bc519c1cc593c | |
parent | 55270d09c212654c4f1bc9ebf9a0081c169a6d12 (diff) | |
download | cpython-git-dd3862e167d573b6e9a3348c365229ca958d1f1f.tar.gz |
bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14626)
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.rst | 6 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2019-07-06-17-19-26.bpo-37487.QagfZ5.rst | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst index 0aed0f3e88..a5e4a45492 100644 --- a/Doc/c-api/list.rst +++ b/Doc/c-api/list.rst @@ -76,9 +76,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. .. versionchanged:: 2.5 This function used an :c:type:`int` for *index*. This might require 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 0000000000..605d08c3c0 --- /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. |