X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cbc139a1f575f951f48b0e120bc79cbfd3cae613..13e64de335db45c87e2d7c8668ce8b16b7cb2139:/src/bindings/python/simgrid_python.cpp diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index af3d7583e4..f900c97a91 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -134,6 +134,7 @@ PYBIND11_MODULE(simgrid, m) .def( "on_exit", [](py::object fun) { + fun.inc_ref(); // FIXME: why is this needed for tests like actor-kill and actor-lifetime? simgrid::s4u::this_actor::on_exit([fun](bool /*failed*/) { GilScopedAcquire py_context; // need a new context for callback try { @@ -151,7 +152,7 @@ PYBIND11_MODULE(simgrid, m) py::class_(m, "Engine", "Simulation Engine") .def(py::init([](std::vector args) { static char noarg[] = {'\0'}; - int argc = args.size(); + int argc = static_cast(args.size()); std::unique_ptr argv(new char*[argc + 1]); for (int i = 0; i != argc; ++i) argv[i] = args[i].empty() ? noarg : &args[i].front(); @@ -198,7 +199,7 @@ PYBIND11_MODULE(simgrid, m) /* Class Host */ py::class_>(m, "Host", "Simulated host") .def("by_name", &Host::by_name, "Retrieves a host from its name, or die") - .def("get_pstate_count", &Host::get_pstate_count, "Retrieve the cound of defined pstate levels") + .def("get_pstate_count", &Host::get_pstate_count, "Retrieve the count of defined pstate levels") .def("get_pstate_speed", &Host::get_pstate_speed, "Retrieve the maximal speed at the given pstate") .def_property( "pstate", &Host::get_pstate, @@ -256,7 +257,13 @@ PYBIND11_MODULE(simgrid, m) // data.dec_ref(); // FIXME: why does it break python-actor-create? return data; }, - py::call_guard(), "Blocking data reception"); + py::call_guard(), "Blocking data reception") + .def("set_receiver", + [](Mailbox* self, ActorPtr actor) { + self->set_receiver(actor); + }, + py::call_guard(), + "Sets the actor as permanent receiver"); /* Class Comm */ py::class_(m, "Comm", "Communication")