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

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Thu Apr 18 05:41:57 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};
----------------
ftynse wrote:

This is a c++20 feature, LLVM is c++17.

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


More information about the Mlir-commits mailing list