pyo3_ffi/cpython/
dictobject.rs

1use crate::object::*;
2use crate::pyport::Py_ssize_t;
3use std::os::raw::c_int;
4
5opaque_struct!(PyDictKeysObject);
6
7#[cfg(Py_3_11)]
8opaque_struct!(PyDictValues);
9
10#[cfg(not(GraalPy))]
11#[repr(C)]
12#[derive(Debug)]
13pub struct PyDictObject {
14    pub ob_base: PyObject,
15    pub ma_used: Py_ssize_t,
16    #[cfg_attr(
17        Py_3_12,
18        deprecated(note = "Deprecated in Python 3.12 and will be removed in the future.")
19    )]
20    pub ma_version_tag: u64,
21    pub ma_keys: *mut PyDictKeysObject,
22    #[cfg(not(Py_3_11))]
23    pub ma_values: *mut *mut PyObject,
24    #[cfg(Py_3_11)]
25    pub ma_values: *mut PyDictValues,
26}
27
28extern "C" {
29    // skipped _PyDict_GetItem_KnownHash
30    // skipped _PyDict_GetItemIdWithError
31    // skipped _PyDict_GetItemStringWithError
32    // skipped PyDict_SetDefault
33    pub fn _PyDict_SetItem_KnownHash(
34        mp: *mut PyObject,
35        key: *mut PyObject,
36        item: *mut PyObject,
37        hash: crate::Py_hash_t,
38    ) -> c_int;
39    // skipped _PyDict_DelItem_KnownHash
40    // skipped _PyDict_DelItemIf
41    // skipped _PyDict_NewKeysForClass
42    pub fn _PyDict_Next(
43        mp: *mut PyObject,
44        pos: *mut Py_ssize_t,
45        key: *mut *mut PyObject,
46        value: *mut *mut PyObject,
47        hash: *mut crate::Py_hash_t,
48    ) -> c_int;
49    // skipped PyDict_GET_SIZE
50    // skipped _PyDict_ContainsId
51    pub fn _PyDict_NewPresized(minused: Py_ssize_t) -> *mut PyObject;
52    // skipped _PyDict_MaybeUntrack
53    // skipped _PyDict_HasOnlyStringKeys
54    // skipped _PyDict_KeysSize
55    // skipped _PyDict_SizeOf
56    // skipped _PyDict_Pop
57    // skipped _PyDict_Pop_KnownHash
58    // skipped _PyDict_FromKeys
59    // skipped _PyDict_HasSplitTable
60    // skipped _PyDict_MergeEx
61    // skipped _PyDict_SetItemId
62    // skipped _PyDict_DelItemId
63    // skipped _PyDict_DebugMallocStats
64    // skipped _PyObjectDict_SetItem
65    // skipped _PyDict_LoadGlobal
66    // skipped _PyDict_GetItemHint
67    // skipped _PyDictViewObject
68    // skipped _PyDictView_New
69    // skipped _PyDictView_Intersect
70
71    #[cfg(Py_3_10)]
72    pub fn _PyDict_Contains_KnownHash(
73        op: *mut PyObject,
74        key: *mut PyObject,
75        hash: crate::Py_hash_t,
76    ) -> c_int;
77
78    #[cfg(not(Py_3_10))]
79    pub fn _PyDict_Contains(mp: *mut PyObject, key: *mut PyObject, hash: Py_ssize_t) -> c_int;
80}