[Mlir-commits] [mlir] [MLIR][transform][python] add sugared python abstractions for transform dialect (PR #75073)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Dec 14 10:38:12 PST 2023


Martin =?utf-8?q?Lücke?= <martin.luecke at ed.ac.uk>,
Martin =?utf-8?q?Lücke?= <martin.luecke at ed.ac.uk>,
Martin =?utf-8?q?Lücke?= <martin.luecke at ed.ac.uk>,
Martin =?utf-8?q?Lücke?= <martin.luecke at ed.ac.uk>,
Martin =?utf-8?q?Lücke?= <martin.luecke at ed.ac.uk>,
Martin =?utf-8?q?Lücke?= <martin.luecke at ed.ac.uk>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/75073 at github.com>


================
@@ -495,6 +495,8 @@ class mlir_type_subclass : public pure_subclass {
           .attr("replace")(superCls.attr("__name__"), captureTypeName);
     });
     if (getTypeIDFunction) {
+      def_staticmethod("get_static_typeid",
+                       [getTypeIDFunction]() { return getTypeIDFunction(); });
----------------
martin-luecke wrote:

This approach has quite a rats tail attached to it because it seems to change the behavior of how other fields are handled. This leads to lots of errors like `AttributeError: 'pybind11_static_property' object attribute '__doc__' is read-only`. 
Pybind uses [this code here](https://github.com/pybind/pybind11/blob/7d538a42750c8580eeaac10e505840a3694b04c8/include/pybind11/detail/class.h#L539) to work around this behavior. 
I will for now leave this as a static function to not introduce more complexity to `pure_subclass` just for this.

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


More information about the Mlir-commits mailing list