From: Paul Brossier Date: Sat, 30 Sep 2017 20:23:54 +0000 (+0200) Subject: python/ext/py-cvec.c: setters to return a negative value on error (closes #17) X-Git-Tag: 0.4.6~11 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=4deb2559e0c36694474a010a1292f0d1605acebd;p=aubio.git python/ext/py-cvec.c: setters to return a negative value on error (closes #17) --- diff --git a/python/ext/py-cvec.c b/python/ext/py-cvec.c index a393c4e2..f584fe7b 100644 --- a/python/ext/py-cvec.c +++ b/python/ext/py-cvec.c @@ -142,14 +142,14 @@ Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure) { npy_intp length; if (!PyAubio_IsValidVector(input)) { - return 1; + return -1; } length = PyArray_SIZE ((PyArrayObject *)input); if (length != vec->length) { PyErr_Format (PyExc_ValueError, "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length, vec->length); - return 1; + return -1; } Py_XDECREF(vec->norm); @@ -163,14 +163,14 @@ Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) { npy_intp length; if (!PyAubio_IsValidVector(input)) { - return 1; + return -1; } length = PyArray_SIZE ((PyArrayObject *)input); if (length != vec->length) { PyErr_Format (PyExc_ValueError, "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length, vec->length); - return 1; + return -1; } Py_XDECREF(vec->phas);