This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Indicate in the docs that PyTuple_GetItem does not support negative indices
Type: Stage: resolved
Components: C API, Documentation Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Yasser Alshalaan, docs@python, vstinner
Priority: normal Keywords: patch

Created on 2020-11-24 09:41 by Antony.Lee, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23529 merged Yasser Alshalaan, 2020-11-27 05:56
Messages (2)
msg381716 - (view) Author: Antony Lee (Antony.Lee) * Date: 2020-11-24 09:41
Unlike `PySequence_GetItem`, `PyTuple_GetItem` does not support negative indices ("indexing from the end").  That is fine, but warrants a notice in the docs (as that behavior is certainly not obvious).
The same wording as for `PyList_GetItem` (changing "list" to "tuple") should be good enough (`PyList_GetItem` currently states: "The 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 IndexError exception.")
msg382132 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-30 09:53
New changeset 9f004634a2bf50c782e223e2eb386ffa769b901c by Yasser A in branch 'master':
bpo-42451: Indicate that PyTuple_GetItem does not support negative indices (GH-23529)
https://github.com/python/cpython/commit/9f004634a2bf50c782e223e2eb386ffa769b901c
History
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86617
2020-11-30 10:34:20Antony.Leesetnosy: - Antony.Lee
2020-11-30 09:53:32vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-11-30 09:53:18vstinnersetnosy: + vstinner
messages: + msg382132
2020-11-27 05:56:13Yasser Alshalaansetkeywords: + patch
nosy: + Yasser Alshalaan

pull_requests: + pull_request22411
stage: patch review
2020-11-24 09:41:26Antony.Leecreate