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

add PyDict::get_item_with_error for PyPy #3270

Merged
merged 2 commits into from Jun 25, 2023

Conversation

davidhewitt
Copy link
Member

Looks like PyPy implemented PyDict_GetItemWithError a couple of years ago in 7.2.0

While correcting I couldn't resist adjusting our wrapper to avoid checking the global exception state on a successful return, and also to use PyErr::take to only access the global exception state once on error.

src/types/dict.rs Outdated Show resolved Hide resolved
src/types/dict.rs Outdated Show resolved Hide resolved
@davidhewitt davidhewitt force-pushed the pypy-getitemerror branch 2 times, most recently from cf8f982 to 955a44e Compare June 25, 2023 18:28
@davidhewitt
Copy link
Member Author

Thanks for the great feedback - I've split this out into two commits. The second commit rebuilds both get_item and get_item_with_error to use a non-generic inner, avoid the pointer-to-temporary, and use PyObject::from_borrowed_ptr_or_opt.

@adamreichold adamreichold added this pull request to the merge queue Jun 25, 2023
Merged via the queue into PyO3:main with commit 575cb2a Jun 25, 2023
32 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.

None yet

2 participants