From f6a9b245d340e96dd4657f17d99cdf15502b0ad7 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 8 Dec 2025 14:46:59 -0600 Subject: [PATCH] Only trigger skipping of outstanding benchmarks on KeyboardInterrupt exception, on others benchmakr is to continue execution --- python/src/py_nvbench.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/src/py_nvbench.cpp b/python/src/py_nvbench.cpp index 159936f..2b09574 100644 --- a/python/src/py_nvbench.cpp +++ b/python/src/py_nvbench.cpp @@ -99,7 +99,16 @@ struct benchmark_wrapper_t } catch (const py::error_already_set &e) { - throw nvbench::stop_runner_loop(e.what()); + if (e.matches(PyExc_KeyboardInterrupt)) + { + // interrupt execution of outstanding instances + throw nvbench::stop_runner_loop(e.what()); + } + else + { + // re-raise + throw; + } } }