classification
Title: PyList_GetItem() document: index can be 0
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: docs@python, terry.reedy, 杨昆仑
Priority: normal Keywords: patch

Created on 2019-07-02 14:49 by 杨昆仑, last changed 2019-07-06 21:56 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 14623 merged terry.reedy, 2019-07-06 21:22
PR 14624 merged miss-islington, 2019-07-06 21:40
PR 14625 merged miss-islington, 2019-07-06 21:40
PR 14626 merged miss-islington, 2019-07-06 21:41
Messages (6)
msg347144 - (view) Author: 杨昆仑 (杨昆仑) Date: 2019-07-02 14:49
The document of this function (PyList_GetItem()) says: "Return the object at position index in the list pointed to by list. The position must be **positive**,". However test shows the correct position index should be from 0 to len(list)-1. The claim of index **must be positive** is inaccurate and confusing.
msg347373 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-05 20:10
Good catch. (In the future, try to include the url, as below.)

The full sentence in question, at https://docs.python.org/3/c-api/list.html#c.PyList_GetItem, is "The position must be positive, indexing from the end of the list is not supported."  'positive' should be 'non-negative'.  The next sentence deal with out-of-bounds positions, and these could be specified as '(< 0, > len(list))'
msg347444 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-06 21:40
New changeset f8709e804d16ec5d44b1d2f00d59a0f78df7b792 by Terry Jan Reedy in branch 'master':
bpo-37487: Fix PyList_GetItem index description. (GH-14623)
https://github.com/python/cpython/commit/f8709e804d16ec5d44b1d2f00d59a0f78df7b792
msg347446 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-06 21:54
New changeset ad3720359faa933d04bde3d3222fd54e73ee7feb by Terry Jan Reedy (Miss Islington (bot)) in branch '3.8':
bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14624)
https://github.com/python/cpython/commit/ad3720359faa933d04bde3d3222fd54e73ee7feb
msg347447 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-06 21:55
New changeset 9c930d076a7225694b369d30636a29acb556c2be by Terry Jan Reedy (Miss Islington (bot)) in branch '3.7':
bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14625)
https://github.com/python/cpython/commit/9c930d076a7225694b369d30636a29acb556c2be
msg347448 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-06 21:55
New changeset dd3862e167d573b6e9a3348c365229ca958d1f1f by Terry Jan Reedy (Miss Islington (bot)) in branch '2.7':
bpo-37487: Fix PyList_GetItem index description. (GH-14623) (GH-14626)
https://github.com/python/cpython/commit/dd3862e167d573b6e9a3348c365229ca958d1f1f
History
Date User Action Args
2019-07-06 21:56:26terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-07-06 21:55:44terry.reedysetmessages: + msg347448
2019-07-06 21:55:22terry.reedysetmessages: + msg347447
2019-07-06 21:54:59terry.reedysetmessages: + msg347446
2019-07-06 21:41:02miss-islingtonsetpull_requests: + pull_request14440
2019-07-06 21:40:51miss-islingtonsetpull_requests: + pull_request14439
2019-07-06 21:40:44miss-islingtonsetstage: commit review -> patch review
pull_requests: + pull_request14438
2019-07-06 21:40:30terry.reedysetmessages: + msg347444
2019-07-06 21:28:06terry.reedysetassignee: docs@python -> terry.reedy
stage: patch review -> commit review
title: PyList_GetItem() document regarding index -> PyList_GetItem() document: index can be 0
versions: + Python 2.7, Python 3.7, Python 3.8, Python 3.9, - Python 3.5
2019-07-06 21:22:35terry.reedysetkeywords: + patch
stage: patch review
pull_requests: + pull_request14437
2019-07-05 20:10:22terry.reedysetnosy: + terry.reedy
messages: + msg347373
2019-07-02 14:49:41杨昆仑create