From: Paul Brossier Date: Tue, 26 Mar 2019 14:22:37 +0000 (+0100) Subject: [py] digital_filter.set_* raise ValueError (see #gh-241) X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=11c46c8ef58f946086e295a21f2235c9eb88c125;p=aubio.git [py] digital_filter.set_* raise ValueError (see #gh-241) --- diff --git a/python/ext/py-filter.c b/python/ext/py-filter.c index 8eb87aa3..19dcc600 100644 --- a/python/ext/py-filter.c +++ b/python/ext/py-filter.c @@ -159,6 +159,11 @@ Py_filter_set_c_weighting (Py_filter * self, PyObject *args) if (PyErr_Occurred() == NULL) { PyErr_SetString (PyExc_ValueError, "error when setting filter to C-weighting"); + } else { + // change the RuntimeError into ValueError + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + PyErr_Restore(PyExc_ValueError, value, traceback); } return NULL; } @@ -179,6 +184,11 @@ Py_filter_set_a_weighting (Py_filter * self, PyObject *args) if (PyErr_Occurred() == NULL) { PyErr_SetString (PyExc_ValueError, "error when setting filter to A-weighting"); + } else { + // change the RuntimeError into ValueError + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + PyErr_Restore(PyExc_ValueError, value, traceback); } return NULL; } @@ -199,6 +209,11 @@ Py_filter_set_biquad(Py_filter * self, PyObject *args) if (PyErr_Occurred() == NULL) { PyErr_SetString (PyExc_ValueError, "error when setting filter with biquad coefficients"); + } else { + // change the RuntimeError into ValueError + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + PyErr_Restore(PyExc_ValueError, value, traceback); } return NULL; }