History

[py] improve digital_filter error messages (closes #gh-241)

Paul Brossier committed 7 years ago

Commit 8bfef301 parent 22e3ef11 file · +12 −6Browse files

Showing the changes to python/ext (1 of 1 file). Show all

Unified · Split

python/ext/py-filter.c+12−6
@@ -156,8 +156,10 @@ Py_filter_set_c_weighting (Py_filter * self, PyObject *args) · 155 unmodified lines
156156
157157 err = aubio_filter_set_c_weighting (self->o, samplerate);
158158 if (err > 0) {
159− PyErr_SetString (PyExc_ValueError,
160− "error when setting filter to C-weighting");
159+ if (PyErr_Occurred() == NULL) {
160+ PyErr_SetString (PyExc_ValueError,
161+ "error when setting filter to C-weighting");
162+ }
161163 return NULL;
162164 }
163165 Py_RETURN_NONE;
@@ -174,8 +176,10 @@ Py_filter_set_a_weighting (Py_filter * self, PyObject *args) · 10 unmodified lines
174176
175177 err = aubio_filter_set_a_weighting (self->o, samplerate);
176178 if (err > 0) {
177− PyErr_SetString (PyExc_ValueError,
178− "error when setting filter to A-weighting");
179+ if (PyErr_Occurred() == NULL) {
180+ PyErr_SetString (PyExc_ValueError,
181+ "error when setting filter to A-weighting");
182+ }
179183 return NULL;
180184 }
181185 Py_RETURN_NONE;
@@ -192,8 +196,10 @@ Py_filter_set_biquad(Py_filter * self, PyObject *args) · 10 unmodified lines
192196
193197 err = aubio_filter_set_biquad (self->o, b0, b1, b2, a1, a2);
194198 if (err > 0) {
195− PyErr_SetString (PyExc_ValueError,
196− "error when setting filter with biquad coefficients");
199+ if (PyErr_Occurred() == NULL) {
200+ PyErr_SetString (PyExc_ValueError,
201+ "error when setting filter with biquad coefficients");
202+ }
197203 return NULL;
198204 }
199205 Py_RETURN_NONE;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t