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

Sergei Lebedev llvmlistbot at llvm.org
Tue Feb 24 01:33:01 PST 2026


================
@@ -652,11 +653,12 @@ class mlir_type_subclass : public pure_subclass {
         "isinstance",
         [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>(
-          nanobind::repr(superCls(self))
-              .attr("replace")(superCls.attr("__name__"), captureTypeName));
-    });
+    def("__repr__",
+        [superCls, captureTypeName](nanobind::object self) -> nanobind::repr {
+          return nanobind::cast<std::string>(
+              nanobind::repr(superCls(self))
+                  .attr("replace")(superCls.attr("__name__"), captureTypeName));
+        });
----------------
superbobry wrote:

Yeah, sorry, rushed to send a PR :)

Fixed now.

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


More information about the Mlir-commits mailing list