Skip to content

Commit 17ac4e6

Browse files
add comments to body of launcher_fn lambda in State.exec method
1 parent 6a60b9b commit 17ac4e6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

python/src/py_nvbench.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,13 @@ PYBIND11_MODULE(_nvbench, m)
449449

450450
pystate_cls.def(
451451
"exec",
452-
[](nvbench::state &state, py::object fn, bool batched, bool sync) {
453-
auto launcher_fn = [fn](nvbench::launch &launch_descr) -> void {
454-
fn(py::cast(std::ref(launch_descr), py::return_value_policy::reference));
452+
[](nvbench::state &state, py::object callable_fn, bool batched, bool sync) {
453+
// wrapper to invoke Python callable
454+
auto launcher_fn = [callable_fn](nvbench::launch &launch_descr) -> void {
455+
// cast C++ object to python object
456+
auto launch_pyarg = py::cast(std::ref(launch_descr), py::return_value_policy::reference);
457+
// call Python callable
458+
callable_fn(launch_pyarg);
455459
};
456460

457461
if (sync)

0 commit comments

Comments
 (0)