pyforge_ffi/compat/
py_3_14.rs1compat_function!(
2 originally_defined_for(all(Py_3_14, not(Py_LIMITED_API)));
3
4 #[inline]
5 pub unsafe fn Py_HashBuffer(
6 ptr: *const std::ffi::c_void,
7 len: crate::Py_ssize_t,
8 ) -> crate::Py_hash_t {
9 #[cfg(not(Py_LIMITED_API))]
10 {
11 crate::_Py_HashBytes(ptr, len)
12 }
13
14 #[cfg(Py_LIMITED_API)]
15 {
16 let bytes = crate::PyBytes_FromStringAndSize(ptr as *const std::ffi::c_char, len);
17 if bytes.is_null() {
18 -1
19 } else {
20 let result = crate::PyObject_Hash(bytes);
21 crate::Py_DECREF(bytes);
22 result
23 }
24 }
25 }
26);
27
28compat_function!(
29 originally_defined_for(Py_3_14);
30
31 #[inline]
32 pub unsafe fn PyIter_NextItem(
33 iter: *mut crate::PyObject,
34 item: *mut *mut crate::PyObject,
35 ) -> std::ffi::c_int {
36 *item = crate::PyIter_Next(iter);
37 if !(*item).is_null() {
38 1
39 } else if crate::PyErr_Occurred().is_null() {
40 0
41 } else {
42 -1
43 }
44 }
45);