From 6b4da8c5cbbfb4962f0a0b79f30079391cff07d0 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 21 Jul 2025 10:57:28 -0500 Subject: [PATCH] add comments to body of launcher_fn lambda in State.exec method --- python/src/py_nvbench.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/src/py_nvbench.cpp b/python/src/py_nvbench.cpp index 80e608b..962bdbd 100644 --- a/python/src/py_nvbench.cpp +++ b/python/src/py_nvbench.cpp @@ -449,9 +449,13 @@ PYBIND11_MODULE(_nvbench, m) pystate_cls.def( "exec", - [](nvbench::state &state, py::object fn, bool batched, bool sync) { - auto launcher_fn = [fn](nvbench::launch &launch_descr) -> void { - fn(py::cast(std::ref(launch_descr), py::return_value_policy::reference)); + [](nvbench::state &state, py::object callable_fn, bool batched, bool sync) { + // wrapper to invoke Python callable + auto launcher_fn = [callable_fn](nvbench::launch &launch_descr) -> void { + // cast C++ object to python object + auto launch_pyarg = py::cast(std::ref(launch_descr), py::return_value_policy::reference); + // call Python callable + callable_fn(launch_pyarg); }; if (sync)