From 4deb2559e0c36694474a010a1292f0d1605acebd Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 30 Sep 2017 22:23:54 +0200 Subject: [PATCH] python/ext/py-cvec.c: setters to return a negative value on error (closes #17) --- python/ext/py-cvec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); -- 2.11.0