From 9b23815ef6b80c6bdea50649cbd97f831b12bb31 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 30 Oct 2018 13:19:53 +0100 Subject: [PATCH] [py] use aubio_log message when set by failed aubio_<>_set_<> --- python/lib/gen_code.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/lib/gen_code.py b/python/lib/gen_code.py index 7527fe9b..1266336b 100644 --- a/python/lib/gen_code.py +++ b/python/lib/gen_code.py @@ -480,7 +480,14 @@ Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args) err = aubio_{shortname}_set_{param} (self->o, {param}); if (err > 0) {{ - PyErr_SetString (PyExc_ValueError, "error running aubio_{shortname}_set_{param}"); + if (PyErr_Occurred() == NULL) {{ + PyErr_SetString (PyExc_ValueError, "error running aubio_{shortname}_set_{param}"); + }} else {{ + // change the RuntimeError into ValueError + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + PyErr_Restore(PyExc_ValueError, value, traceback); + }} return NULL; }} Py_RETURN_NONE; -- 2.11.0