py::module m, const py::module &irModule) {
auto attributeClass = irModule.attr("Attribute");
- py::enum_<MlirSparseTensorDimLevelType>(m, "DimLevelType")
+ py::enum_<MlirSparseTensorDimLevelType>(m, "DimLevelType", py::module_local())
.value("dense", MLIR_SPARSE_TENSOR_DIM_LEVEL_DENSE)
.value("compressed", MLIR_SPARSE_TENSOR_DIM_LEVEL_COMPRESSED)
.value("singleton", MLIR_SPARSE_TENSOR_DIM_LEVEL_SINGLETON);
}
static void bind(pybind11::module &m) {
- auto cls = ClassTy(m, DerivedTy::pyClassName, pybind11::buffer_protocol());
+ auto cls = ClassTy(m, DerivedTy::pyClassName, pybind11::buffer_protocol(),
+ pybind11::module_local());
cls.def(pybind11::init<PyAttribute &>(), pybind11::keep_alive<0, 1>());
DerivedTy::bindDerived(cls);
}
}
static void bind(pybind11::module &m) {
- auto cls = ClassTy(m, DerivedTy::pyClassName);
+ auto cls = ClassTy(m, DerivedTy::pyClassName, pybind11::module_local());
cls.def(pybind11::init<PyType &>(), pybind11::keep_alive<0, 1>());
cls.def_static("isinstance", [](PyType &otherType) -> bool {
return DerivedTy::isaFunction(otherType);
/// Binds the indexing and length methods in the Python class.
static void bind(pybind11::module &m) {
- auto clazz = pybind11::class_<Derived>(m, Derived::pyClassName)
+ auto clazz = pybind11::class_<Derived>(m, Derived::pyClassName,
+ pybind11::module_local())
.def("__len__", &Sliceable::dunderLen)
.def("__getitem__", &Sliceable::dunderGetItem)
.def("__getitem__", &Sliceable::dunderGetItemSlice);