[Mlir-commits] [mlir] [mlir][python] Fix Python binding cast diagnostics for nanobind 2.13 (PR #206391)

Maksim Levental llvmlistbot at llvm.org
Sun Jun 28 20:57:49 PDT 2026


================
@@ -43,14 +43,15 @@ static void pyListToVector(const nb::sequence &list, std::vector<CType> &result,
   for (nb::handle item : list) {
     try {
       result.push_back(nb::cast<PyType>(item));
-    } catch (nb::cast_error &err) {
+    } catch (std::exception &err) {
----------------
makslevental wrote:

Ah now I understand - if you just use `nb::cast_error` then it'll regress on nb<2.13 (because there the exception will still be either/or `nb::cast_error` or `std::runtime_error`) and so using `std::exception` is backwards compatible.

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


More information about the Mlir-commits mailing list