From 5cbcdd93d3e5e69aa8ebda13ad6b02085a3fb5f7 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 23 Nov 2020 17:59:17 +0100 Subject: python: multi_usrp: Fix get_radio_control() This function was incorrectly wrapped into Python and would fail with Python saying it can't hold a reference to the radio block. This changes the wrapping into returning a raw pointer, but also makes the return value policy reference_internal so that garbage collection happens in the right order. --- host/lib/usrp/multi_usrp_python.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/multi_usrp_python.cpp b/host/lib/usrp/multi_usrp_python.cpp index c1ee17d0b..34bb96338 100644 --- a/host/lib/usrp/multi_usrp_python.cpp +++ b/host/lib/usrp/multi_usrp_python.cpp @@ -90,7 +90,7 @@ void export_multi_usrp(py::module& m) .def("get_mboard_sensor" , &multi_usrp::get_mboard_sensor, py::arg("name"), py::arg("mboard") = 0) .def("get_mboard_sensor_names" , &multi_usrp::get_mboard_sensor_names, py::arg("mboard") = 0) .def("set_user_register" , &multi_usrp::set_user_register, py::arg("addr"), py::arg("data"), py::arg("mboard") = ALL_MBOARDS) - .def("get_radio_control" , &multi_usrp::get_radio_control, py::arg("chan") = 0) + .def("get_radio_control" , [](multi_usrp& self, const size_t chan){ return &self.get_radio_control(chan); }, py::arg("chan") = 0, py::return_value_policy::reference_internal) .def("get_mb_controller" , &multi_usrp::get_mb_controller, py::arg("mboard") = 0) // RX methods -- cgit v1.2.3