Files
Maksim Levental 6a12b7c74b [mlir][python] Fix Python binding cast diagnostics for nanobind 2.13 (#206391)
nanobind 2.13.0 changed failing `nb::cast<T>()` to raise `cast_error`
(an alias for `std::bad_cast`) for all failures, including `None`,
instead of the previous distinct exception types. The bindings relied on
catching `std::runtime_error` separately from `cast_error` to emit a
helpful "(None?)" hint, so that branch became dead code and the `None`
diagnostics regressed (e.g. "(std::bad_cast)" instead of "(None?)"),
breaking check-mlir Python tests.

Fix: Decide the `None` hint from the value via `is_none()` rather than
the exception type. This is robust across nanobind versions (2.10-2.13).

Fixes #205329 

Assisted by: Claude
2026-06-28 21:05:54 -07:00
..
…
…
…