[Mlir-commits] [mlir] [MLIR] [Python] Added return type to `__repr__` in the adaptors (PR #182867)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Feb 24 01:57:34 PST 2026


================
@@ -653,7 +654,7 @@ class mlir_type_subclass : public pure_subclass {
         [isaFunction](MlirType other) { return isaFunction(other); },
         nanobind::arg("other_type"), nanobind::sig(kIsinstanceSig));
     def("__repr__", [superCls, captureTypeName](nanobind::object self) {
-      return nanobind::cast<std::string>(
+      return cast<nanobind : str>(
----------------
PragmaTwice wrote:

what's this? seriously?
```suggestion
      return nanobind::str(
```

to be honest you don't need to change it. `std::string` maps to `str` in type stubs..

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


More information about the Mlir-commits mailing list