[Mlir-commits] [mlir] [MLIR][Python] Add a DSL for defining dialects in Python bindings (PR #169045)

Rolf Morel llvmlistbot at llvm.org
Thu Jan 22 08:29:00 PST 2026


================
@@ -957,7 +957,7 @@ class MLIR_PYTHON_API_EXPORTED PyConcreteType : public BaseTy {
   }
 
   static void bind(nanobind::module_ &m) {
-    auto cls = ClassTy(m, DerivedTy::pyClassName);
+    auto cls = ClassTy(m, DerivedTy::pyClassName, nanobind::is_generic());
----------------
rolfmorel wrote:

Just because I looked up what this method is for: should we similarly "lie" in the signature as is suggested by the nanobind documentation here: [Therefore, we lie about this in the stub and declare typing.Generic[T] as a base class. Only static type checkers will see this information, and it helps them to interpret how the type works.](https://nanobind.readthedocs.io/en/latest/typing.html#creating-generic-types:~:text=Therefore%2C%20we%20lie%20about%20this%20in%20the%20stub%20and%20declare%20typing.Generic%5BT%5D%20as%20a%20base%20class.%20Only%20static%20type%20checkers%20will%20see%20this%20information%2C%20and%20it%20helps%20them%20to%20interpret%20how%20the%20type%20works.)

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


More information about the Mlir-commits mailing list