MLIR  21.0.0git
Classes | Functions
nanobind::detail Namespace Reference

Classes

struct  type_caster< MlirAffineMap >
 Casts object <-> MlirAffineMap. More...
 
struct  type_caster< MlirAttribute >
 Casts object <-> MlirAttribute. More...
 
struct  type_caster< MlirBlock >
 Casts object -> MlirBlock. More...
 
struct  type_caster< MlirContext >
 Casts object -> MlirContext. More...
 
struct  type_caster< MlirDialectRegistry >
 Casts object <-> MlirDialectRegistry. More...
 
struct  type_caster< MlirLocation >
 Casts object <-> MlirLocation. More...
 
struct  type_caster< MlirModule >
 Casts object <-> MlirModule. More...
 
struct  type_caster< MlirFrozenRewritePatternSet >
 Casts object <-> MlirFrozenRewritePatternSet. More...
 
struct  type_caster< MlirOperation >
 Casts object <-> MlirOperation. More...
 
struct  type_caster< MlirValue >
 Casts object <-> MlirValue. More...
 
struct  type_caster< MlirPassManager >
 Casts object -> MlirPassManager. More...
 
struct  type_caster< MlirTypeID >
 Casts object <-> MlirTypeID. More...
 
struct  type_caster< MlirType >
 Casts object <-> MlirType. More...
 
struct  type_caster< MlirStringRef >
 Casts MlirStringRef -> object. More...
 
struct  type_caster< mlir::python::DefaultingPyMlirContext >
 
struct  type_caster< mlir::python::DefaultingPyLocation >
 
struct  MlirDefaultingCaster
 

Functions

static nanobind::object mlirApiObjectToCapsule (nanobind::handle apiObject)
 Helper to convert a presumed MLIR API object to a capsule, accepting either an explicit Capsule (which can happen when two C APIs are communicating directly via Python) or indirectly by querying the MLIR_PYTHON_CAPI_PTR_ATTR attribute (through which supported MLIR Python API objects export their contained API pointer as a capsule). More...
 

Function Documentation

◆ mlirApiObjectToCapsule()

static nanobind::object nanobind::detail::mlirApiObjectToCapsule ( nanobind::handle  apiObject)
static

Helper to convert a presumed MLIR API object to a capsule, accepting either an explicit Capsule (which can happen when two C APIs are communicating directly via Python) or indirectly by querying the MLIR_PYTHON_CAPI_PTR_ATTR attribute (through which supported MLIR Python API objects export their contained API pointer as a capsule).

Throws a type error if the object is neither. This is intended to be used from type casters, which are invoked with a raw handle (unowned). The returned object's lifetime may not extend beyond the apiObject handle without explicitly having its refcount increased (i.e. on return).

Definition at line 46 of file NanobindAdaptors.h.

References MLIR_PYTHON_CAPI_PTR_ATTR.

Referenced by nanobind::detail::type_caster< MlirAffineMap >::from_python(), nanobind::detail::type_caster< MlirAttribute >::from_python(), nanobind::detail::type_caster< MlirBlock >::from_python(), nanobind::detail::type_caster< MlirContext >::from_python(), nanobind::detail::type_caster< MlirDialectRegistry >::from_python(), nanobind::detail::type_caster< MlirLocation >::from_python(), nanobind::detail::type_caster< MlirModule >::from_python(), nanobind::detail::type_caster< MlirOperation >::from_python(), nanobind::detail::type_caster< MlirValue >::from_python(), nanobind::detail::type_caster< MlirPassManager >::from_python(), nanobind::detail::type_caster< MlirTypeID >::from_python(), and nanobind::detail::type_caster< MlirType >::from_python().