Skip to content

expose unchecked getters for PyList and PyTuple under abi3#6075

Merged
Icxolu merged 6 commits into
PyO3:mainfrom
davidhewitt:list-get-item-unchecked
May 31, 2026
Merged

expose unchecked getters for PyList and PyTuple under abi3#6075
Icxolu merged 6 commits into
PyO3:mainfrom
davidhewitt:list-get-item-unchecked

Conversation

@davidhewitt
Copy link
Copy Markdown
Member

I was looking at the list iterators and noticed that we can probably implement PyList::get_item_unchecked (and similar for tuple) by using the stable ABI symbols and just assuming that no error is returned.

This leads to some nice simplifications in the code!

Copy link
Copy Markdown
Member

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplifications!

Comment thread src/types/list.rs Outdated
Comment thread src/types/list.rs Outdated
Comment thread src/types/tuple.rs
Comment thread src/types/list.rs Outdated
Copy link
Copy Markdown
Contributor

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification!

@Icxolu Icxolu added this pull request to the merge queue May 31, 2026
Merged via the queue into PyO3:main with commit de5816a May 31, 2026
46 of 47 checks passed
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

Successfully merging this pull request may close these issues.

3 participants