From: Paul Brossier Date: Tue, 26 Mar 2019 14:17:05 +0000 (+0100) Subject: [py] improve digital_filter error messages (closes #gh-241) X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=8bfef308c4143ba57559a4cce7ecee6a0afe1f76;ds=sidebyside [py] improve digital_filter error messages (closes #gh-241) --- diff --git a/python/ext/py-filter.c b/python/ext/py-filter.c index 861f8cd6..8eb87aa3 100644 --- a/python/ext/py-filter.c +++ b/python/ext/py-filter.c @@ -156,8 +156,10 @@ Py_filter_set_c_weighting (Py_filter * self, PyObject *args) err = aubio_filter_set_c_weighting (self->o, samplerate); if (err > 0) { - PyErr_SetString (PyExc_ValueError, - "error when setting filter to C-weighting"); + if (PyErr_Occurred() == NULL) { + PyErr_SetString (PyExc_ValueError, + "error when setting filter to C-weighting"); + } return NULL; } Py_RETURN_NONE; @@ -174,8 +176,10 @@ Py_filter_set_a_weighting (Py_filter * self, PyObject *args) err = aubio_filter_set_a_weighting (self->o, samplerate); if (err > 0) { - PyErr_SetString (PyExc_ValueError, - "error when setting filter to A-weighting"); + if (PyErr_Occurred() == NULL) { + PyErr_SetString (PyExc_ValueError, + "error when setting filter to A-weighting"); + } return NULL; } Py_RETURN_NONE; @@ -192,8 +196,10 @@ Py_filter_set_biquad(Py_filter * self, PyObject *args) err = aubio_filter_set_biquad (self->o, b0, b1, b2, a1, a2); if (err > 0) { - PyErr_SetString (PyExc_ValueError, - "error when setting filter with biquad coefficients"); + if (PyErr_Occurred() == NULL) { + PyErr_SetString (PyExc_ValueError, + "error when setting filter with biquad coefficients"); + } return NULL; } Py_RETURN_NONE;