From: Paul Brossier Date: Fri, 21 Dec 2018 15:41:30 +0000 (+0100) Subject: [py] raise an exception when reading source failed X-Git-Tag: 0.4.9~28 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=519d5d30fc1b3722802cc7c8821823eb6bbce25a;p=aubio.git [py] raise an exception when reading source failed --- diff --git a/python/ext/py-source.c b/python/ext/py-source.c index 7687fbd9..d3c28e80 100644 --- a/python/ext/py-source.c +++ b/python/ext/py-source.c @@ -436,6 +436,10 @@ Py_source_do(Py_source * self, PyObject * args) /* compute _do function */ aubio_source_do (self->o, &(self->c_read_to), &read); + if (PyErr_Occurred() != NULL) { + return NULL; + } + outputs = PyTuple_New(2); PyTuple_SetItem( outputs, 0, self->read_to ); PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read)); @@ -457,6 +461,10 @@ Py_source_do_multi(Py_source * self, PyObject * args) /* compute _do function */ aubio_source_do_multi (self->o, &(self->c_mread_to), &read); + if (PyErr_Occurred() != NULL) { + return NULL; + } + outputs = PyTuple_New(2); PyTuple_SetItem( outputs, 0, self->mread_to); PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read));