History

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

Paul Brossier committed 9 years ago

Commit 4deb2551 parent 5b679ba1 file · +4 −4Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/ext/py-cvec.c+4−4
@@ -142,14 +142,14 @@ Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure) · 141 unmodified lines
142{142{
143 npy_intp length;143 npy_intp length;
144 if (!PyAubio_IsValidVector(input)) {144 if (!PyAubio_IsValidVector(input)) {
145 return 1;145 return -1;
146 }146 }
147 length = PyArray_SIZE ((PyArrayObject *)input);147 length = PyArray_SIZE ((PyArrayObject *)input);
148 if (length != vec->length) {148 if (length != vec->length) {
149 PyErr_Format (PyExc_ValueError,149 PyErr_Format (PyExc_ValueError,
150 "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length,150 "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length,
151 vec->length);151 vec->length);
152 return 1;152 return -1;
153 }153 }
154 154
155 Py_XDECREF(vec->norm);155 Py_XDECREF(vec->norm);
@@ -163,14 +163,14 @@ Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) · 7 unmodified lines
163{163{
164 npy_intp length;164 npy_intp length;
165 if (!PyAubio_IsValidVector(input)) {165 if (!PyAubio_IsValidVector(input)) {
166 return 1;166 return -1;
167 }167 }
168 length = PyArray_SIZE ((PyArrayObject *)input);168 length = PyArray_SIZE ((PyArrayObject *)input);
169 if (length != vec->length) {169 if (length != vec->length) {
170 PyErr_Format (PyExc_ValueError,170 PyErr_Format (PyExc_ValueError,
171 "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length,171 "input array has length %" NPY_INTP_FMT ", but cvec has length %d", length,
172 vec->length);172 vec->length);
173 return 1;173 return -1;
174 }174 }
175 175
176 Py_XDECREF(vec->phas);176 Py_XDECREF(vec->phas);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t