From a88dc9f026f6067c057fcf800dac182d157e08f3 Mon Sep 17 00:00:00 2001 From: Stephen Shelton Date: Mon, 6 Jul 2020 17:39:22 -0600 Subject: [PATCH] Prevent pybind from deleting HiveRouter pointers --- pybind/llarp/context.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pybind/llarp/context.cpp b/pybind/llarp/context.cpp index a179a0a32..b15b67bae 100644 --- a/pybind/llarp/context.cpp +++ b/pybind/llarp/context.cpp @@ -47,6 +47,9 @@ namespace tooling { using HiveContext_ptr = std::shared_ptr; py::class_(mod, "HiveContext") - .def("getRouterAsHiveRouter", &tooling::HiveContext::getRouterAsHiveRouter); + .def( + "getRouterAsHiveRouter", + &tooling::HiveContext::getRouterAsHiveRouter, + py::return_value_policy::reference); } } // namespace tooling