From 519d5d30fc1b3722802cc7c8821823eb6bbce25a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 21 Dec 2018 16:41:30 +0100 Subject: [PATCH] [py] raise an exception when reading source failed --- python/ext/py-source.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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)); -- 2.11.0