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: PyList_GetItem() clarification
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, splitscreen, stefan
Priority: normal Keywords:

Created on 2006-04-05 03:38 by stefan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg28090 - (view) Author: Stefan Seefeld (stefan) * (Python committer) Date: 2006-04-05 03:38
The PyList_GetItem function is documented at

http://docs.python.org/api/listObjects.html

as returning "...the object at position pos...".
However, even though in python -1 is a valid index,
this function expects a 'real' index.

1) I believe it would be worthwhile pointing out in
   the API docs that in fact a positive value is
   expected.

2) It would be good to change the function signature
   to expect an unsigned int instead of an int for
   the index.
msg28091 - (view) Author: Matt Fleming (splitscreen) Date: 2006-04-05 11:59
Logged In: YES 
user_id=1126061

I agree with these suggestions. It's not impossible for
someone to 'just assume' a negative index is handled
correctly by PyList_GetItem().

+1
msg28092 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-04-06 12:46
Logged In: YES 
user_id=849994

Thanks! Fixed in rev. 43704, 43705.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43160
2006-04-05 03:38:23stefancreate