From 26b14d5cca3c39c4f40223854ad2a1d59464b797 Mon Sep 17 00:00:00 2001
From: ManifoldFR <wilson.jallet@polytechnique.org>
Date: Wed, 22 May 2024 19:37:13 +0200
Subject: [PATCH] registration.hpp : apply suggested incref() fix

---
 include/eigenpy/registration.hpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/eigenpy/registration.hpp b/include/eigenpy/registration.hpp
index 7644f291..a2f13fc9 100644
--- a/include/eigenpy/registration.hpp
+++ b/include/eigenpy/registration.hpp
@@ -45,6 +45,7 @@ inline bool register_symbolic_link_to_registered_type() {
     const bp::converter::registration* reg =
         bp::converter::registry::query(info);
     bp::handle<> class_obj(reg->get_class_object());
+    bp::incref(class_obj.get());
     bp::scope().attr(reg->get_class_object()->tp_name) = bp::object(class_obj);
     return true;
   }
@@ -61,6 +62,7 @@ inline bool register_symbolic_link_to_registered_type(const Visitor& visitor) {
     const bp::converter::registration* reg =
         bp::converter::registry::query(info);
     bp::handle<> class_obj(reg->get_class_object());
+    bp::incref(class_obj.get());
     bp::object object(class_obj);
     bp::scope().attr(reg->get_class_object()->tp_name) = object;
     registration_class<T> cl(object);
-- 
GitLab