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

Define _PyDict_Contains_KnownHash() FFI for CPython 3.10 or later #3088

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/3088.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Define `_PyDict_Contains_KnownHash()` FFI for CPython 3.10 or later.
9 changes: 8 additions & 1 deletion pyo3-ffi/src/cpython/dictobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ extern "C" {
hash: *mut crate::Py_hash_t,
) -> c_int;
// skipped PyDict_GET_SIZE
// skipped _PyDict_Contains_KnownHash
// skipped _PyDict_ContainsId
pub fn _PyDict_NewPresized(minused: Py_ssize_t) -> *mut PyObject;
// skipped _PyDict_MaybeUntrack
Expand All @@ -63,6 +62,14 @@ extern "C" {
// skipped _PyDictViewObject
// skipped _PyDictView_New
// skipped _PyDictView_Intersect

#[cfg(Py_3_10)]
pub fn _PyDict_Contains_KnownHash(
op: *mut PyObject,
key: *mut PyObject,
hash: crate::Py_hash_t,
) -> c_int;

#[cfg(not(Py_3_10))]
pub fn _PyDict_Contains(mp: *mut PyObject, key: *mut PyObject, hash: Py_ssize_t) -> c_int;
}