[all-commits] [llvm/llvm-project] 657f1c: [mlir][python] Fix Python binding cast diagnostics...
Maksim Levental via All-commits
all-commits at lists.llvm.org
Sun Jun 28 19:28:55 PDT 2026
Branch: refs/heads/users/makslevental/fix-nanobind-2.13-cast-diagnostic
Home: https://github.com/llvm/llvm-project
Commit: 657f1ccfbfc0dfd0abadc7477275404f01699598
https://github.com/llvm/llvm-project/commit/657f1ccfbfc0dfd0abadc7477275404f01699598
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-06-28 (Sun, 28 Jun 2026)
Changed paths:
M mlir/include/mlir/Bindings/Python/IRAttributes.h
M mlir/lib/Bindings/Python/IRAffine.cpp
M mlir/lib/Bindings/Python/IRCore.cpp
Log Message:
-----------
[mlir][python] Fix Python binding cast diagnostics for nanobind 2.13
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.
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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list