MLIR  16.0.0git
Classes | Functions
pybind11::detail Namespace Reference

Classes

struct  MlirDefaultingCaster
 
struct  type_caster< llvm::Optional< T > >
 
struct  type_caster< mlir::python::DefaultingPyLocation >
 
struct  type_caster< mlir::python::DefaultingPyMlirContext >
 
struct  type_caster< MlirAffineMap >
 Casts object <-> MlirAffineMap. More...
 
struct  type_caster< MlirAttribute >
 Casts object <-> MlirAttribute. 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< MlirOperation >
 Casts object <-> MlirOperation. More...
 
struct  type_caster< MlirPassManager >
 Casts object -> MlirPassManager. More...
 
struct  type_caster< MlirType >
 Casts object <-> MlirType. More...
 
struct  type_caster< MlirValue >
 Casts object <-> MlirValue. More...
 

Functions

static py::object mlirApiObjectToCapsule (py::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 py::object pybind11::detail::mlirApiObjectToCapsule ( py::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 50 of file PybindAdaptors.h.

References MLIR_PYTHON_CAPI_PTR_ATTR.

Referenced by pybind11::detail::type_caster< MlirAffineMap >::load(), pybind11::detail::type_caster< MlirAttribute >::load(), pybind11::detail::type_caster< MlirContext >::load(), pybind11::detail::type_caster< MlirDialectRegistry >::load(), pybind11::detail::type_caster< MlirLocation >::load(), pybind11::detail::type_caster< MlirModule >::load(), pybind11::detail::type_caster< MlirOperation >::load(), pybind11::detail::type_caster< MlirValue >::load(), pybind11::detail::type_caster< MlirPassManager >::load(), and pybind11::detail::type_caster< MlirType >::load().