pyo3_ffi/cpython/
pyhash.rs1#[cfg(Py_3_14)]
2use crate::Py_ssize_t;
3#[cfg(Py_3_13)]
4use crate::{PyObject, Py_hash_t};
5#[cfg(any(Py_3_13, not(PyPy)))]
6use core::ffi::c_void;
7#[cfg(not(PyPy))]
8use core::ffi::{c_char, c_int};
9
10#[cfg(not(PyPy))]
11#[repr(C)]
12#[derive(Copy, Clone)]
13pub struct PyHash_FuncDef {
14 pub hash:
15 Option<extern "C" fn(arg1: *const c_void, arg2: crate::Py_ssize_t) -> crate::Py_hash_t>,
16 pub name: *const c_char,
17 pub hash_bits: c_int,
18 pub seed_bits: c_int,
19}
20
21extern_libpython! {
22 #[cfg(not(PyPy))]
23 pub fn PyHash_GetFuncDef() -> *mut PyHash_FuncDef;
24 #[cfg(Py_3_13)]
25 pub fn Py_HashPointer(ptr: *const c_void) -> Py_hash_t;
26 #[cfg(Py_3_13)]
27 pub fn PyObject_GenericHash(obj: *mut PyObject) -> Py_hash_t;
28 #[cfg(Py_3_14)]
29 pub fn Py_HashBuffer(ptr: *const c_void, len: Py_ssize_t) -> Py_hash_t;
30}