shithub: aubio

Download patch

ref: 4deb2559e0c36694474a010a1292f0d1605acebd
parent: 5b679ba15fcc7ab1b381e4c0f97d4f401a16e14e
author: Paul Brossier <piem@piem.org>
date: Sat Sep 30 18:23:54 EDT 2017

python/ext/py-cvec.c: setters to return a negative value on error (closes #17)

--- a/python/ext/py-cvec.c
+++ b/python/ext/py-cvec.c
@@ -142,7 +142,7 @@
 {
   npy_intp length;
   if (!PyAubio_IsValidVector(input)) {
-    return 1;
+    return -1;
   }
   length = PyArray_SIZE ((PyArrayObject *)input);
   if (length != vec->length) {
@@ -149,7 +149,7 @@
     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,7 +163,7 @@
 {
   npy_intp length;
   if (!PyAubio_IsValidVector(input)) {
-    return 1;
+    return -1;
   }
   length = PyArray_SIZE ((PyArrayObject *)input);
   if (length != vec->length) {
@@ -170,7 +170,7 @@
     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);