Make sure a copy of the source output is taken before resizing it.
Showing the changes to python/ext (1 of 1 file). Show all
Unified · Split
| @@ -573,7 +573,9 @@ static PyObject* Pyaubio_source_iter_next(Py_source *self) { · 572 unmodified lines | ||
| 573 | 573 | return vec; |
| 574 | 574 | } else if (PyLong_AsLong(size) > 0) { |
| 575 | 575 | // short read, return a shorter array |
| 576 | − PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0); | |
| 576 | + PyArrayObject *shortread = (PyArrayObject*) | |
| 577 | + PyArray_FROM_OTF(PyTuple_GetItem(done, 0), NPY_NOTYPE, | |
| 578 | + NPY_ARRAY_ENSURECOPY); | |
| 577 | 579 | PyArray_Dims newdims; |
| 578 | 580 | PyObject *reshaped; |
| 579 | 581 | newdims.len = PyArray_NDIM(shortread); |