Expand description
Implementation details of #[pymodule] which need to be accessible from proc-macro generated code.
Re-exportsΒ§
use core::cell::UnsafeCell;πuse core::ffi::CStr;πuse core::ffi::c_int;πuse core::ffi::c_void;πuse core::marker::PhantomData;πuse core::sync::atomic::Ordering;πNeither GraalPynorPyPyand not (Py_LIMITED_APIand Windows and non-Py_3_10)use core::sync::atomic::AtomicI64;πtarget_has_atomic=64and neitherGraalPynorPyPyand not (Py_LIMITED_APIand Windows and non-Py_3_10)use crate::exceptions::PyImportError;πNeither GraalPynorPyPyuse crate::ffi_ptr_ext::FfiPtrExt;πuse crate::internal_tricks::array_ptr_as_mut;πPy_3_15or not (Py_GIL_DISABLEDandPy_LIMITED_API)use crate::prelude::PyTypeMethods;πuse crate::Bound;πuse crate::PyClass;πuse crate::PyErr;πuse crate::PyResult;πuse crate::PyTypeInfo;πuse crate::ffi;πuse crate::impl_::pyfunction::PyFunctionDef;πuse crate::types::PyModule;πuse crate::types::PyModuleMethods;πuse crate::Py;πuse crate::PyAny;πuse crate::Python;πuse crate::sync::PyOnceLock;πuse crate::types::PyDict;πuse crate::types::any::PyAnyMethods;πuse crate::types::dict::PyDictMethods;πuse crate::err;πuse crate::py_result_ext::PyResultExt;πuse crate::platform::prelude::*;π
StructsΒ§
- AddClass
ToModule - For adding a class to a module.
- AddType
ToModule - For adding native types (non-pyclass) to a module.
- Module
Def Syncwrapper offfi::PyModuleDef.- PyModule
DefSlots Not ( Py_GIL_DISABLEDandPy_LIMITED_API) - Slots to populate a
PyModuleDefCannot create aPyModuleDefon abi3t due to lack of knowledge of object layout - PyModule
Slots - Wrapper to safely store module slots, to be used in a
ModuleDef. - PyModule
Slots Builder - Builder to create module slots. The size of the number of slots desired must be known up front, and N needs to be at least one greater than the number of actual slots pushed due to the need to have a zeroed element on the end.
ConstantsΒ§
- MAX_
SLOTS π - MAX_
SLOTS_ πWITH_ TRAILING_ NULL
TraitsΒ§
- PyAdd
ToModule - Trait to add an element (class, functionβ¦) to a module.
- PyModule
Init Result - Used to accept either
()orResult<(), E>from a#[pymodule_init]function.
FunctionsΒ§
Type AliasesΒ§
- Module
Exec Slot - Type of the exec slot used to initialise module contents
- Primary
Module Slots Non- Py_3_15 - On Python 3.14 and older the primary system is
ffi::PyModuleDef. - Secondary
Module Slots Not ( Py_3_15and not (Py_GIL_DISABLEDandPy_LIMITED_API))