(bench) python fasttimer should check for exceptions

This commit is contained in:
K. Lange 2022-06-04 15:33:23 +09:00
parent cd25ada161
commit b2846c13ce

View File

@ -29,6 +29,10 @@ fasttimer_timeit(PyObject * self, PyObject * args, PyObject* kwargs)
for (int t = 0; t < times; ++t) { for (int t = 0; t < times; ++t) {
/* Call it here */ /* Call it here */
PyObject_CallObject(callable, NULL); PyObject_CallObject(callable, NULL);
if (PyErr_Occurred()) {
Py_XDECREF(callable);
return NULL;
}
} }
gettimeofday(&tv_after,NULL); gettimeofday(&tv_after,NULL);
Py_XDECREF(callable); Py_XDECREF(callable);