Revert "[mlir] fix crash in PybindAdaptors.h"
authorAlex Zinenko <zinenko@google.com>
Mon, 17 Jan 2022 09:55:36 +0000 (10:55 +0100)
committerAlex Zinenko <zinenko@google.com>
Mon, 17 Jan 2022 09:56:01 +0000 (10:56 +0100)
This reverts commit 970cb57ef72c9045250e0492cb00127b49ddfea8.

Broke the buildbot.

mlir/include/mlir/Bindings/Python/PybindAdaptors.h

index 68942e5..0340e9c 100644 (file)
@@ -320,11 +320,7 @@ public:
     // Casting constructor. Note that defining an __init__ method is special
     // and not yet generalized on pure_subclass (it requires a somewhat
     // different cpp_function and other requirements on chaining to super
-    // __init__ make it more awkward to do generally). It is marked as
-    // `is_new_style_constructor` to suppress the deprecation warning from
-    // pybind11 related to placement-new since we are not doing any allocation
-    // here but relying on the superclass constructor that does "new-style"
-    // allocation for pybind11.
+    // __init__ make it more awkward to do generally).
     std::string captureTypeName(
         typeClassName); // As string in case if typeClassName is not static.
     py::cpp_function initCf(
@@ -340,9 +336,7 @@ public:
           }
           superClass.attr("__init__")(self, otherType);
         },
-        py::name("__init__"), py::arg("cast_from_type"),
-        py::is_method(scope.attr(typeClassName)),
-        py::detail::is_new_style_constructor(),
+        py::arg("cast_from_type"), py::is_method(py::none()),
         "Casts the passed type to this specific sub-type.");
     thisClass.attr("__init__") = initCf;
 
@@ -377,11 +371,7 @@ public:
     // Casting constructor. Note that defining an __init__ method is special
     // and not yet generalized on pure_subclass (it requires a somewhat
     // different cpp_function and other requirements on chaining to super
-    // __init__ make it more awkward to do generally). It is marked as
-    // `is_new_style_constructor` to suppress the deprecation warning from
-    // pybind11 related to placement-new since we are not doing any allocation
-    // here but relying on the superclass constructor that does "new-style"
-    // allocation for pybind11.
+    // __init__ make it more awkward to do generally).
     std::string captureTypeName(
         typeClassName); // As string in case if typeClassName is not static.
     py::cpp_function initCf(
@@ -397,9 +387,7 @@ public:
           }
           superClass.attr("__init__")(self, otherType);
         },
-        py::name("__init__"), py::arg("cast_from_type"),
-        py::is_method(scope.attr(typeClassName)),
-        py::detail::is_new_style_constructor(),
+        py::arg("cast_from_type"), py::is_method(py::none()),
         "Casts the passed type to this specific sub-type.");
     thisClass.attr("__init__") = initCf;