[Mlir-commits] [mlir] [mlir][py] Mark all type caster `from_{cpp, python}` methods as noexcept (PR #143866)

Nicholas Junge llvmlistbot at llvm.org
Fri Jun 20 06:24:26 PDT 2025


nicholasjng wrote:

Thanks for the review. It is relevant, since we're now terminating because of an exception thrown in one of the type casters. The `mlirApiObjectToCapsule()` API seems responsible: https://github.com/llvm/llvm-project/blob/349f8d67d4ee2e7a6045b02f6aea0a72165404b1/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h#L53-L57

I'm unsure how to proceed - on the one hand, the docs are pretty clear that `noexcept` is required (and e.g. XLA changed all of its type casters to `noexcept` as well), but I don't think I can fix this without a bit of refactoring.

cc @hawkinsp for a review (hope that's okay).

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


More information about the Mlir-commits mailing list