[Mlir-commits] [mlir] ef5a11a - [MLIR][Python] Fix generic class signature of ir.Value (#182447)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 20 01:05:36 PST 2026


Author: Twice
Date: 2026-02-20T17:05:31+08:00
New Revision: ef5a11a51d9e888ec8455751067712d69d5d603e

URL: https://github.com/llvm/llvm-project/commit/ef5a11a51d9e888ec8455751067712d69d5d603e
DIFF: https://github.com/llvm/llvm-project/commit/ef5a11a51d9e888ec8455751067712d69d5d603e.diff

LOG: [MLIR][Python] Fix generic class signature of ir.Value (#182447)

In the type stub, `Generic` isn’t explicitly imported. This causes
Pyright/Pylance to report an error and treat `Value` as not being a
generic type. Explicitly using `typing.Generic` fixes this.

Added: 
    

Modified: 
    mlir/lib/Bindings/Python/IRCore.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp
index 4aef8a95dcc2f..9d74d9edce4b5 100644
--- a/mlir/lib/Bindings/Python/IRCore.cpp
+++ b/mlir/lib/Bindings/Python/IRCore.cpp
@@ -4685,7 +4685,7 @@ void populateIRCore(nb::module_ &m) {
   m.attr("_T") = nb::type_var("_T", "bound"_a = m.attr("Type"));
 
   nb::class_<PyValue>(m, "Value", nb::is_generic(),
-                      nb::sig("class Value(Generic[_T])"))
+                      nb::sig("class Value(typing.Generic[_T])"))
       .def(nb::init<PyValue &>(), nb::keep_alive<0, 1>(), "value"_a,
            "Creates a Value reference from another `Value`.")
       .def_prop_ro(MLIR_PYTHON_CAPI_PTR_ATTR, &PyValue::getCapsule,


        


More information about the Mlir-commits mailing list