projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8bfef30
)
[py] digital_filter.set_* raise ValueError (see #gh-241)
author
Paul Brossier
<piem@piem.org>
Tue, 26 Mar 2019 14:22:37 +0000
(15:22 +0100)
committer
Paul Brossier
<piem@piem.org>
Tue, 26 Mar 2019 14:22:37 +0000
(15:22 +0100)
python/ext/py-filter.c
patch
|
blob
|
history
diff --git
a/python/ext/py-filter.c
b/python/ext/py-filter.c
index
8eb87aa
..
19dcc60
100644
(file)
--- 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");
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;
}
}
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");
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;
}
}
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");
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;
}
}
return NULL;
}