[Mlir-commits] [mlir] [mlir][python] Fix PyOperationBase::walk not catching exception in python callback (PR #89225)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Apr 18 05:57:24 PDT 2024


================
@@ -1255,14 +1255,31 @@ void PyOperationBase::walk(
     MlirWalkOrder walkOrder) {
   PyOperation &operation = getOperation();
   operation.checkValid();
+  struct UserData {
+    std::function<MlirWalkResult(MlirOperation)> callback;
+    bool gotException;
+    std::string exceptionWhat;
+    py::object exceptionType;
+  };
+  UserData userData{.callback = callback};
----------------
tomnatan30 wrote:

Done.

https://github.com/llvm/llvm-project/pull/89225


More information about the Mlir-commits mailing list