pub use self::any::{PyAny, PyAnyMethods};
pub use self::boolobject::{PyBool, PyBoolMethods};
pub use self::bytearray::{PyByteArray, PyByteArrayMethods};
pub use self::bytes::{PyBytes, PyBytesMethods};
pub use self::capsule::{PyCapsule, PyCapsuleMethods};
#[cfg(all(not(Py_LIMITED_API), not(PyPy), not(GraalPy)))]
pub use self::code::PyCode;
pub use self::complex::{PyComplex, PyComplexMethods};
#[cfg(not(Py_LIMITED_API))]
#[allow(deprecated)]
pub use self::datetime::{
timezone_utc, timezone_utc_bound, PyDate, PyDateAccess, PyDateTime, PyDelta, PyDeltaAccess,
PyTime, PyTimeAccess, PyTzInfo, PyTzInfoAccess,
};
pub use self::dict::{IntoPyDict, PyDict, PyDictMethods};
#[cfg(not(any(PyPy, GraalPy)))]
pub use self::dict::{PyDictItems, PyDictKeys, PyDictValues};
pub use self::ellipsis::PyEllipsis;
pub use self::float::{PyFloat, PyFloatMethods};
#[cfg(all(not(Py_LIMITED_API), not(PyPy), not(GraalPy)))]
pub use self::frame::PyFrame;
pub use self::frozenset::{PyFrozenSet, PyFrozenSetBuilder, PyFrozenSetMethods};
pub use self::function::PyCFunction;
#[cfg(all(not(Py_LIMITED_API), not(all(PyPy, not(Py_3_8))), not(GraalPy)))]
pub use self::function::PyFunction;
pub use self::iterator::PyIterator;
pub use self::list::{PyList, PyListMethods};
pub use self::mapping::{PyMapping, PyMappingMethods};
pub use self::memoryview::PyMemoryView;
pub use self::module::{PyModule, PyModuleMethods};
pub use self::none::PyNone;
pub use self::notimplemented::PyNotImplemented;
#[allow(deprecated)]
pub use self::num::{PyInt, PyLong};
#[cfg(not(any(PyPy, GraalPy)))]
pub use self::pysuper::PySuper;
pub use self::sequence::{PySequence, PySequenceMethods};
pub use self::set::{PySet, PySetMethods};
pub use self::slice::{PySlice, PySliceIndices, PySliceMethods};
#[cfg(not(Py_LIMITED_API))]
pub use self::string::PyStringData;
#[allow(deprecated)]
pub use self::string::{PyString, PyStringMethods, PyUnicode};
pub use self::traceback::{PyTraceback, PyTracebackMethods};
pub use self::tuple::{PyTuple, PyTupleMethods};
pub use self::typeobject::{PyType, PyTypeMethods};
pub use self::weakref::{PyWeakref, PyWeakrefMethods, PyWeakrefProxy, PyWeakrefReference};
pub mod iter {
pub use super::dict::BoundDictIterator;
pub use super::frozenset::BoundFrozenSetIterator;
pub use super::list::BoundListIterator;
pub use super::set::BoundSetIterator;
pub use super::tuple::{BorrowedTupleIterator, BoundTupleIterator};
}
pub trait DerefToPyAny {
}
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_named (
($name:ty $(;$generics:ident)*) => {
impl<$($generics,)*> ::std::convert::AsRef<$crate::PyAny> for $name {
#[inline]
fn as_ref(&self) -> &$crate::PyAny {
&self.0
}
}
impl<$($generics,)*> ::std::ops::Deref for $name {
type Target = $crate::PyAny;
#[inline]
fn deref(&self) -> &$crate::PyAny {
&self.0
}
}
impl $crate::types::DerefToPyAny for $name {}
};
);
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_static_type_object(
($typeobject:expr) => {
|_py| {
#[allow(unused_unsafe)] unsafe { ::std::ptr::addr_of_mut!($typeobject) }
}
};
);
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_info(
($name:ty, $typeobject:expr, $module:expr $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
#[allow(unsafe_code)]
unsafe impl<$($generics,)*> $crate::type_object::PyTypeInfo for $name {
const NAME: &'static str = stringify!($name);
const MODULE: ::std::option::Option<&'static str> = $module;
#[inline]
#[allow(clippy::redundant_closure_call)]
fn type_object_raw(py: $crate::Python<'_>) -> *mut $crate::ffi::PyTypeObject {
$typeobject(py)
}
$(
#[inline]
fn is_type_of_bound(obj: &$crate::Bound<'_, $crate::PyAny>) -> bool {
#[allow(unused_unsafe)]
unsafe { $checkfunction(obj.as_ptr()) > 0 }
}
)?
}
impl $name {
#[doc(hidden)]
pub const _PYO3_DEF: $crate::impl_::pymodule::AddTypeToModule<Self> = $crate::impl_::pymodule::AddTypeToModule::new();
}
};
);
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_core {
($name:ty, $typeobject:expr, #module=$module:expr $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
$crate::pyobject_native_type_named!($name $(;$generics)*);
$crate::pyobject_native_type_info!($name, $typeobject, $module $(, #checkfunction=$checkfunction)? $(;$generics)*);
};
($name:ty, $typeobject:expr $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
$crate::pyobject_native_type_core!($name, $typeobject, #module=::std::option::Option::Some("builtins") $(, #checkfunction=$checkfunction)? $(;$generics)*);
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_subclassable_native_type {
($name:ty, $layout:path $(;$generics:ident)*) => {
#[cfg(not(Py_LIMITED_API))]
impl<$($generics,)*> $crate::impl_::pyclass::PyClassBaseType for $name {
type LayoutAsBase = $crate::impl_::pycell::PyClassObjectBase<$layout>;
type BaseNativeType = $name;
type Initializer = $crate::pyclass_init::PyNativeTypeInitializer<Self>;
type PyClassMutability = $crate::pycell::impl_::ImmutableClass;
}
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_sized {
($name:ty, $layout:path $(;$generics:ident)*) => {
unsafe impl $crate::type_object::PyLayout<$name> for $layout {}
impl $crate::type_object::PySizedLayout<$name> for $layout {}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type {
($name:ty, $layout:path, $typeobject:expr $(, #module=$module:expr)? $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
$crate::pyobject_native_type_core!($name, $typeobject $(, #module=$module)? $(, #checkfunction=$checkfunction)? $(;$generics)*);
#[cfg(not(Py_LIMITED_API))]
$crate::pyobject_native_type_sized!($name, $layout $(;$generics)*);
};
}
pub(crate) mod any;
pub(crate) mod boolobject;
pub(crate) mod bytearray;
pub(crate) mod bytes;
pub(crate) mod capsule;
#[cfg(all(not(Py_LIMITED_API), not(PyPy), not(GraalPy)))]
mod code;
pub(crate) mod complex;
#[cfg(not(Py_LIMITED_API))]
pub(crate) mod datetime;
pub(crate) mod dict;
mod ellipsis;
pub(crate) mod float;
#[cfg(all(not(Py_LIMITED_API), not(PyPy), not(GraalPy)))]
mod frame;
pub(crate) mod frozenset;
mod function;
pub(crate) mod iterator;
pub(crate) mod list;
pub(crate) mod mapping;
mod memoryview;
pub(crate) mod module;
mod none;
mod notimplemented;
mod num;
#[cfg(not(any(PyPy, GraalPy)))]
mod pysuper;
pub(crate) mod sequence;
pub(crate) mod set;
pub(crate) mod slice;
pub(crate) mod string;
pub(crate) mod traceback;
pub(crate) mod tuple;
pub(crate) mod typeobject;
pub(crate) mod weakref;