diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -2026,6 +2026,10 @@ // Mapping of Operation. //---------------------------------------------------------------------------- py::class_(m, "_OperationBase", py::module_local()) + .def_property_readonly(MLIR_PYTHON_CAPI_PTR_ATTR, + [](PyOperationBase &self) { + return self.getOperation().getCapsule(); + }) .def("__eq__", [](PyOperationBase &self, PyOperationBase &other) { return &self.getOperation() == &other.getOperation();