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    #[cfg(not(Py_3_14))]
21    pub ma_version_tag: u64,
22    #[cfg(Py_3_14)]
23    pub _ma_watcher_tag: u64,
24    pub ma_keys: *mut PyDictKeysObject,
25    #[cfg(not(Py_3_11))]
26    pub ma_values: *mut *mut PyObject,
27    #[cfg(Py_3_11)]
28    pub ma_values: *mut PyDictValues,
29}
30
31extern "C" {
32    // skipped _PyDict_GetItem_KnownHash
33    // skipped _PyDict_GetItemIdWithError
34    // skipped _PyDict_GetItemStringWithError
35    // skipped PyDict_SetDefault
36    pub fn _PyDict_SetItem_KnownHash(
37        mp: *mut PyObject,
38        key: *mut PyObject,
39        item: *mut PyObject,
40        hash: crate::Py_hash_t,
41    ) -> c_int;
42    // skipped _PyDict_DelItem_KnownHash
43    // skipped _PyDict_DelItemIf
44    // skipped _PyDict_NewKeysForClass
45    pub fn _PyDict_Next(
46        mp: *mut PyObject,
47        pos: *mut Py_ssize_t,
48        key: *mut *mut PyObject,
49        value: *mut *mut PyObject,
50        hash: *mut crate::Py_hash_t,
51    ) -> c_int;
52    // skipped PyDict_GET_SIZE
53    // skipped _PyDict_ContainsId
54    pub fn _PyDict_NewPresized(minused: Py_ssize_t) -> *mut PyObject;
55    // skipped _PyDict_MaybeUntrack
56    // skipped _PyDict_HasOnlyStringKeys
57    // skipped _PyDict_KeysSize
58    // skipped _PyDict_SizeOf
59    // skipped _PyDict_Pop
60    // skipped _PyDict_Pop_KnownHash
61    // skipped _PyDict_FromKeys
62    // skipped _PyDict_HasSplitTable
63    // skipped _PyDict_MergeEx
64    // skipped _PyDict_SetItemId
65    // skipped _PyDict_DelItemId
66    // skipped _PyDict_DebugMallocStats
67    // skipped _PyObjectDict_SetItem
68    // skipped _PyDict_LoadGlobal
69    // skipped _PyDict_GetItemHint
70    // skipped _PyDictViewObject
71    // skipped _PyDictView_New
72    // skipped _PyDictView_Intersect
73
74    #[cfg(Py_3_10)]
75    pub fn _PyDict_Contains_KnownHash(
76        op: *mut PyObject,
77        key: *mut PyObject,
78        hash: crate::Py_hash_t,
79    ) -> c_int;
80
81    #[cfg(not(Py_3_10))]
82    pub fn _PyDict_Contains(mp: *mut PyObject, key: *mut PyObject, hash: Py_ssize_t) -> c_int;
83}
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here