Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyList_GetItem() clarification #43160

Closed
stefanseefeld mannequin opened this issue Apr 5, 2006 · 3 comments
Closed

PyList_GetItem() clarification #43160

stefanseefeld mannequin opened this issue Apr 5, 2006 · 3 comments

Comments

@stefanseefeld
Copy link
Mannequin

stefanseefeld mannequin commented Apr 5, 2006

BPO 1464658
Nosy @birkenfeld, @stefanseefeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2006-04-06.12:46:16.000>
created_at = <Date 2006-04-05.03:38:23.000>
labels = []
title = 'PyList_GetItem() clarification'
updated_at = <Date 2006-04-06.12:46:16.000>
user = 'https://github.com/stefanseefeld'

bugs.python.org fields:

activity = <Date 2006-04-06.12:46:16.000>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2006-04-05.03:38:23.000>
creator = 'stefan'
dependencies = []
files = []
hgrepos = []
issue_num = 1464658
keywords = []
message_count = 3.0
messages = ['28090', '28091', '28092']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'stefan', 'splitscreen']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1464658'
versions = []

@stefanseefeld
Copy link
Mannequin Author

stefanseefeld mannequin commented Apr 5, 2006

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.

@stefanseefeld stefanseefeld mannequin closed this as completed Apr 5, 2006
@stefanseefeld stefanseefeld mannequin closed this as completed Apr 5, 2006
@splitscreen
Copy link
Mannequin

splitscreen mannequin commented Apr 5, 2006

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

@birkenfeld
Copy link
Member

Logged In: YES
user_id=849994

Thanks! Fixed in rev. 43704, 43705.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant