[Mlir-commits] [mlir] [mlir][python] Add stable ABI (abi3) support (PR #183856)

Maksim Levental llvmlistbot at llvm.org
Sat Feb 28 20:41:52 PST 2026


================
@@ -383,8 +420,54 @@ class Sliceable {
     return elements;
   }
 
+  // Manually implement the sequence protocol via the C API. We do this
+  // because it is approx 4x faster than via nanobind, largely because that
+  // formulation requires a C++ exception to be thrown to detect end of
+  // sequence.
+  // Since we are in a C-context, any C++ exception that happens here
+  // will terminate the program. There is nothing in this implementation
+  // that should throw in a non-terminal way, so we forgo further
+  // exception marshalling.
+  // See: https://github.com/pybind/nanobind/issues/2842
----------------
makslevental wrote:

nit (not your fault):
```suggestion
  // See: https://github.com/pybind/pybind11/issues/2842
```

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


More information about the Mlir-commits mailing list