[issue42451] Indicate in the docs that PyTuple_GetItem does not support negative indices

New submission from Antony Lee anntzer.lee@gmail.com:
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.")
---------- assignee: docs@python components: C API, Documentation messages: 381716 nosy: Antony.Lee, docs@python priority: normal severity: normal status: open title: Indicate in the docs that PyTuple_GetItem does not support negative indices versions: Python 3.10
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42451 _______________________________________

Change by Yasser Alshalaan yalshalaan@gmail.com:
---------- keywords: +patch nosy: +Yasser Alshalaan nosy_count: 2.0 -> 3.0 pull_requests: +22411 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23529
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42451 _______________________________________

STINNER Victor vstinner@python.org added the comment:
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/9f004634a2bf50c782e223e2eb386ffa769...
---------- nosy: +vstinner
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42451 _______________________________________

Change by STINNER Victor vstinner@python.org:
---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42451 _______________________________________

Change by Antony Lee anntzer.lee@gmail.com:
---------- nosy: -Antony.Lee
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42451 _______________________________________
participants (3)
-
Antony Lee
-
STINNER Victor
-
Yasser Alshalaan