From b2846c13ce2bdea5614193fc74e70adb990206c5 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Sat, 4 Jun 2022 15:33:23 +0900 Subject: [PATCH] (bench) python fasttimer should check for exceptions --- bench/fasttimer/py_fasttimer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bench/fasttimer/py_fasttimer.c b/bench/fasttimer/py_fasttimer.c index 69e8a19..8b2dd51 100644 --- a/bench/fasttimer/py_fasttimer.c +++ b/bench/fasttimer/py_fasttimer.c @@ -29,6 +29,10 @@ fasttimer_timeit(PyObject * self, PyObject * args, PyObject* kwargs) for (int t = 0; t < times; ++t) { /* Call it here */ PyObject_CallObject(callable, NULL); + if (PyErr_Occurred()) { + Py_XDECREF(callable); + return NULL; + } } gettimeofday(&tv_after,NULL); Py_XDECREF(callable);