44#include < core/scalar_factory.hpp>
55#include < cstddef>
66#include < cstdlib>
7+ #include < exception>
78#include < memory>
89#include < pybind11/cast.h>
910#include < pybind11/detail/common.h>
@@ -52,9 +53,12 @@ namespace PythonBindings
5253 auto exec (std::shared_ptr<Api::SimulationInstance>& handle)
5354 {
5455 pybind11::gil_scoped_release release; // TODO check if really usefull ?
55- handle->exec ();
56+ const auto ret = handle->exec ();
5657 pybind11::gil_scoped_acquire acquire;
57- return 0 ;
58+ if (ret.invalid ())
59+ {
60+ throw std::runtime_error (ret.get ());
61+ }
5862 }
5963
6064 auto apply (std::shared_ptr<Api::SimulationInstance>& handle, bool to_load)
@@ -66,13 +70,10 @@ namespace PythonBindings
6670 }
6771
6872 auto register_cma_path (std::shared_ptr<Api::SimulationInstance>& handle,
69- const std::string& cma_path,
70- bool recursive)
73+ const std::string& cma_path)
7174 {
7275
73- return (recursive)
74- ? register_cma_path_recursive (handle.get (), cma_path.data ())
75- : ::register_cma_path (handle.get (), cma_path.data ());
76+ return ::register_cma_path (handle.get (), cma_path.data ());
7677 }
7778
7879 auto
@@ -109,7 +110,6 @@ namespace PythonBindings
109110 .def_readwrite (" force_override" , &wrap_c_param_t ::force_override)
110111 .def_readwrite (" n_thread" , &wrap_c_param_t ::n_thread)
111112 .def_readwrite (" number_exported_result" , &wrap_c_param_t ::number_exported_result)
112- .def_readwrite (" recursive" , &wrap_c_param_t ::recursive)
113113 .def_readwrite (" biomass_initial_concentration" ,
114114 &wrap_c_param_t ::biomass_initial_concentration)
115115 .def_readwrite (" number_particle" , &wrap_c_param_t ::number_particle)
@@ -128,13 +128,12 @@ namespace PythonBindings
128128 p.force_override ,
129129 p.n_thread ,
130130 p.number_exported_result ,
131- p.recursive ,
132131 p.biomass_initial_concentration ,
133132 p.number_particle ,
134133 p.save_serde );
135134 },
136135 [](const py::tuple& t) { // __setstate__
137- constexpr std::size_t n_attributes = 9 ;
136+ constexpr std::size_t n_attributes = 8 ;
138137 if (t.size () != n_attributes)
139138 {
140139 throw std::runtime_error (" Pickle param invalid state, "
@@ -151,10 +150,9 @@ namespace PythonBindings
151150 p.force_override = static_cast <int >(t[2 ].cast <bool >());
152151 p.n_thread = t[3 ].cast <int >();
153152 p.number_exported_result = t[4 ].cast <int >();
154- p.recursive = static_cast <int >(t[5 ].cast <bool >());
155- p.biomass_initial_concentration = t[6 ].cast <double >();
156- p.number_particle = t[7 ].cast <int >();
157- p.save_serde = t[8 ].cast <int >();
153+ p.biomass_initial_concentration = t[5 ].cast <double >();
154+ p.number_particle = t[6 ].cast <int >();
155+ p.save_serde = t[7 ].cast <int >();
158156 // NOLINTEND
159157 return p;
160158 }));
@@ -198,8 +196,7 @@ PYBIND11_MODULE(handle_module, m) // NOLINT (Pybind11 MACRO)
198196 m.def (" register_cma_path" ,
199197 &PythonBindings::register_cma_path,
200198 py::arg (" handle" ),
201- py::arg (" cma_path" ),
202- py::arg (" recursive" ) = false );
199+ py::arg (" cma_path" ));
203200
204201 m.def (" register_serde" , ®ister_serde);
205202 m.def (" register_parameters" , ®ister_parameters);
0 commit comments