[mlir] Use the correct base class for Attributes in Python bindings
authorAlex Zinenko <zinenko@google.com>
Tue, 20 Oct 2020 09:22:02 +0000 (11:22 +0200)
committerAlex Zinenko <zinenko@google.com>
Wed, 21 Oct 2020 07:49:23 +0000 (09:49 +0200)
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

mlir/lib/Bindings/Python/IRModules.cpp

index 0c3e541..b0b2483 100644 (file)
@@ -919,7 +919,7 @@ public:
   // 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;