[Mlir-commits] [mlir] 31782cd - [mlir] Use the correct base class for Attributes in Python bindings

Alex Zinenko llvmlistbot at llvm.org
Wed Oct 21 00:52:54 PDT 2020


Author: Alex Zinenko
Date: 2020-10-21T09:49:23+02:00
New Revision: 31782cd2199b808cda6733d6448e1314e2c8ec96

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

LOG: [mlir] Use the correct base class for Attributes in Python bindings

The pybind class typedef for concrete attribute classes was erroneously
deriving all of them from PyAttribute instead of the provided base class. This
has not been triggering any error because only one level of the hierarchy is
currently exposed.

Differential Revision: https://reviews.llvm.org/D89779

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bindings/Python/IRModules.cpp b/mlir/lib/Bindings/Python/IRModules.cpp
index 0c3e541d18b2..b0b24837276c 100644
--- a/mlir/lib/Bindings/Python/IRModules.cpp
+++ b/mlir/lib/Bindings/Python/IRModules.cpp
@@ -919,7 +919,7 @@ class PyConcreteAttribute : public BaseTy {
   // Derived classes must define statics for:
   //   IsAFunctionTy isaFunction
   //   const char *pyClassName
-  using ClassTy = py::class_<DerivedTy, PyAttribute>;
+  using ClassTy = py::class_<DerivedTy, BaseTy>;
   using IsAFunctionTy = int (*)(MlirAttribute);
 
   PyConcreteAttribute() = default;


        


More information about the Mlir-commits mailing list