| 1 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 2 | originally_defined_for(Py_3_13); |
| 3 | |
| 4 | #[inline] |
| 5 | pub unsafe fn PyDict_GetItemRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyDict_GetItemRef().( |
| 6 | dp: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 7 | key: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 8 | result: *mut *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 9 | ) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 10 | use craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::{compatrust-analyzer cargo pyo3-ffi 0.28.2 compat/::Py_NewRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/Py_NewRef()., PyDict_GetItemWithErrorrust-analyzer cargo pyo3-ffi 0.28.2 PyDict_GetItemWithError()., PyErr_Occurredrust-analyzer cargo pyo3-ffi 0.28.2 PyErr_Occurred().}; |
| 11 | |
| 12 | let item = PyDict_GetItemWithErrorrust-analyzer cargo pyo3-ffi 0.28.2 PyDict_GetItemWithError().(dp, key); |
| 13 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().item.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().() { |
| 14 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().result = Py_NewRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/Py_NewRef().(item); |
| 15 | return 1; // found |
| 16 | } |
| 17 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().result = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(); |
| 18 | if PyErr_Occurredrust-analyzer cargo pyo3-ffi 0.28.2 PyErr_Occurred().().is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().() { |
| 19 | return 0; // not found |
| 20 | } |
| 21 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1 |
| 22 | } |
| 23 | ); |
| 24 | |
| 25 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 26 | originally_defined_for(Py_3_13); |
| 27 | |
| 28 | #[inline] |
| 29 | pub unsafe fn PyList_GetItemRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyList_GetItemRef().( |
| 30 | arg1: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 31 | arg2: craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::Py_ssize_trust-analyzer cargo pyo3-ffi 0.28.2 pyport/Py_ssize_t#, |
| 32 | ) -> *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject# { |
| 33 | use craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::{PyList_GetItemrust-analyzer cargo pyo3-ffi 0.28.2 PyList_GetItem()., Py_XINCREFrust-analyzer cargo pyo3-ffi 0.28.2 refcount/Py_XINCREF().}; |
| 34 | |
| 35 | let item = PyList_GetItemrust-analyzer cargo pyo3-ffi 0.28.2 PyList_GetItem().(arg1, arg2); |
| 36 | Py_XINCREFrust-analyzer cargo pyo3-ffi 0.28.2 refcount/Py_XINCREF().(item); |
| 37 | item |
| 38 | } |
| 39 | ); |
| 40 | |
| 41 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 42 | originally_defined_for(Py_3_13); |
| 43 | |
| 44 | #[inline] |
| 45 | pub unsafe fn PyImport_AddModuleRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyImport_AddModuleRef().( |
| 46 | name: *const stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#, |
| 47 | ) -> *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject# { |
| 48 | use craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::{compatrust-analyzer cargo pyo3-ffi 0.28.2 compat/::Py_XNewRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/Py_XNewRef()., PyImport_AddModulerust-analyzer cargo pyo3-ffi 0.28.2 PyImport_AddModule().}; |
| 49 | |
| 50 | Py_XNewRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/Py_XNewRef().(PyImport_AddModulerust-analyzer cargo pyo3-ffi 0.28.2 PyImport_AddModule().(name)) |
| 51 | } |
| 52 | ); |
| 53 | |
| 54 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 55 | originally_defined_for(Py_3_13); |
| 56 | |
| 57 | #[inline] |
| 58 | pub unsafe fn PyWeakref_GetRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyWeakref_GetRef().( |
| 59 | reference: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 60 | pobj: *mut *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 61 | ) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 62 | use craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::{ |
| 63 | compatrust-analyzer cargo pyo3-ffi 0.28.2 compat/::Py_NewRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/Py_NewRef()., PyErr_SetStringrust-analyzer cargo pyo3-ffi 0.28.2 PyErr_SetString()., PyExc_TypeErrorrust-analyzer cargo pyo3-ffi 0.28.2 PyExc_TypeError., PyWeakref_Checkrust-analyzer cargo pyo3-ffi 0.28.2 weakrefobject/PyWeakref_Check()., |
| 64 | PyWeakref_GetObjectrust-analyzer cargo pyo3-ffi 0.28.2 PyWeakref_GetObject()., Py_Nonerust-analyzer cargo pyo3-ffi 0.28.2 object/Py_None()., |
| 65 | }; |
| 66 | |
| 67 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().reference.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().() && PyWeakref_Checkrust-analyzer cargo pyo3-ffi 0.28.2 weakrefobject/PyWeakref_Check().(reference) == 0 { |
| 68 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().pobj = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(); |
| 69 | PyErr_SetStringrust-analyzer cargo pyo3-ffi 0.28.2 PyErr_SetString().(PyExc_TypeErrorrust-analyzer cargo pyo3-ffi 0.28.2 PyExc_TypeError., c"expected a weakref".as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().()); |
| 70 | return -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1; |
| 71 | } |
| 72 | let obj = PyWeakref_GetObjectrust-analyzer cargo pyo3-ffi 0.28.2 PyWeakref_GetObject().(reference); |
| 73 | if obj.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().() { |
| 74 | // SystemError if reference is NULL |
| 75 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().pobj = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(); |
| 76 | return -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1; |
| 77 | } |
| 78 | if obj == Py_Nonerust-analyzer cargo pyo3-ffi 0.28.2 object/Py_None().() { |
| 79 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().pobj = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(); |
| 80 | return 0; |
| 81 | } |
| 82 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().pobj = Py_NewRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/Py_NewRef().(obj); |
| 83 | 1 |
| 84 | } |
| 85 | ); |
| 86 | |
| 87 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 88 | originally_defined_for(Py_3_13); |
| 89 | |
| 90 | #[inline] |
| 91 | pub unsafe fn PyList_Extendrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyList_Extend().( |
| 92 | list: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 93 | iterable: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 94 | ) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 95 | craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyList_SetSlicerust-analyzer cargo pyo3-ffi 0.28.2 PyList_SetSlice().(list, craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PY_SSIZE_T_MAXrust-analyzer cargo pyo3-ffi 0.28.2 pyport/PY_SSIZE_T_MAX., craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PY_SSIZE_T_MAXrust-analyzer cargo pyo3-ffi 0.28.2 pyport/PY_SSIZE_T_MAX., iterable) |
| 96 | } |
| 97 | ); |
| 98 | |
| 99 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 100 | originally_defined_for(Py_3_13); |
| 101 | |
| 102 | #[inline] |
| 103 | pub unsafe fn PyList_Clearrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyList_Clear().(list: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 104 | craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyList_SetSlicerust-analyzer cargo pyo3-ffi 0.28.2 PyList_SetSlice().(list, 0, craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PY_SSIZE_T_MAXrust-analyzer cargo pyo3-ffi 0.28.2 pyport/PY_SSIZE_T_MAX., stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().()) |
| 105 | } |
| 106 | ); |
| 107 | |
| 108 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 109 | originally_defined_for(Py_3_13); |
| 110 | |
| 111 | #[inline] |
| 112 | pub unsafe fn PyModule_Addrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_13/PyModule_Add().( |
| 113 | module: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 114 | name: *const stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#, |
| 115 | value: *mut craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::PyObjectrust-analyzer cargo pyo3-ffi 0.28.2 object/PyObject#, |
| 116 | ) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 117 | let result = craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::compatrust-analyzer cargo pyo3-ffi 0.28.2 compat/::PyModule_AddObjectRefrust-analyzer cargo pyo3-ffi 0.28.2 compat/py_3_10/PyModule_AddObjectRef().(module, name, value); |
| 118 | craterust-analyzer cargo pyo3-ffi 0.28.2 crate/::Py_XDECREFrust-analyzer cargo pyo3-ffi 0.28.2 refcount/Py_XDECREF().(value); |
| 119 | result |
| 120 | } |
| 121 | ); |
| 122 | |
| 123 | #[cfg(not(Py_LIMITED_API))] |
| 124 | compat_functionrust-analyzer cargo pyo3-ffi 0.28.2 compat/compat_function!!( |
| 125 | originally_defined_for(Py_3_13); |
| 126 | |
| 127 | #[inline] |
| 128 | pub unsafe fn PyThreadState_GetUnchecked( |
| 129 | ) -> *mut crate::PyThreadState { |
| 130 | crate::_PyThreadState_UncheckedGet() |
| 131 | } |
| 132 | ); |