From 9be4fa3dfbe808b9b0cb4be08f0f6adf12e5bf1b Mon Sep 17 00:00:00 2001
From: ManifoldFR <wilson.jallet@polytechnique.org>
Date: Thu, 20 Apr 2023 14:08:43 +0200
Subject: [PATCH] tests/python: use old-style call to parent ctor

---
 unittest/bind_virtual_factory.cpp    | 12 +++++++-----
 unittest/python/test_bind_virtual.py |  5 +++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/unittest/bind_virtual_factory.cpp b/unittest/bind_virtual_factory.cpp
index f4ec49d..f3861ca 100644
--- a/unittest/bind_virtual_factory.cpp
+++ b/unittest/bind_virtual_factory.cpp
@@ -24,7 +24,7 @@ struct MyVirtualClass {
 };
 
 struct MyVirtualData {
-  MyVirtualData(MyVirtualClass const&) {}
+  MyVirtualData(MyVirtualClass const &) {}
   virtual ~MyVirtualData() {}  // virtual dtor to mark class as polymorphic
 };
 
@@ -84,8 +84,9 @@ struct VirtualClassWrapper : MyVirtualClass, bp::wrapper<MyVirtualClass> {
 /// This "trampoline class" does nothing but is ABSOLUTELY required to ensure
 /// downcasting works properly with non-smart ptr signatures. Otherwise,
 /// there is no handle to the original Python object ( @c PyObject *).
-/// Every single polymorphic type exposed to Python should be exposed through such a trampoline.
-/// Users can also create their own wrapper classes by taking inspiration from boost::python::wrapper<T>.
+/// Every single polymorphic type exposed to Python should be exposed through
+/// such a trampoline. Users can also create their own wrapper classes by taking
+/// inspiration from boost::python::wrapper<T>.
 struct DataWrapper : MyVirtualData, bp::wrapper<MyVirtualData> {
   /// we have to use-declare non-defaulted constructors
   /// (see https://en.cppreference.com/w/cpp/language/default_constructor)
@@ -99,7 +100,8 @@ const MyVirtualData &iden_ref(const MyVirtualData &d) {
   return d;
 }
 
-/// Take a shared_ptr (by const reference or value, doesn't matter), return by const reference
+/// Take a shared_ptr (by const reference or value, doesn't matter), return by
+/// const reference
 const MyVirtualData &iden_shared(const shared_ptr<MyVirtualData> &d) {
   // get boost.python's custom deleter
   // boost.python hides the handle to the original object in there
@@ -136,7 +138,7 @@ BOOST_PYTHON_MODULE(bind_virtual_factory) {
   /// otherwise if passed as "HeldType", we need to define
   /// the constructor and call initializer manually.
   bp::class_<DataWrapper, boost::noncopyable>("MyVirtualData", bp::no_init)
-      .def(bp::init<MyVirtualClass const&>(bp::args("self", "model")));
+      .def(bp::init<MyVirtualClass const &>(bp::args("self", "model")));
 
   bp::def("callDoSomethingPtr", callDoSomethingPtr, bp::args("obj"));
   bp::def("callDoSomethingRef", callDoSomethingRef, bp::args("obj"));
diff --git a/unittest/python/test_bind_virtual.py b/unittest/python/test_bind_virtual.py
index 558a3e0..c4b5ef2 100644
--- a/unittest/python/test_bind_virtual.py
+++ b/unittest/python/test_bind_virtual.py
@@ -4,7 +4,7 @@ import bind_virtual_factory as bvf
 class ImplClass(bvf.MyVirtualClass):
     def __init__(self):
         self.val = 42
-        super().__init__()
+        bvf.MyVirtualClass.__init__(self)
 
     def createData(self):
         return ImplData(self)
@@ -27,7 +27,8 @@ class ImplClass(bvf.MyVirtualClass):
 
 class ImplData(bvf.MyVirtualData):
     def __init__(self, c):
-        super().__init__(c)  # parent virtual class requires arg
+        # parent virtual class requires arg
+        bvf.MyVirtualData.__init__(self, c)
         self.value = c.val
 
 
-- 
GitLab