shithub: aubio

Download patch

ref: 8e76c71be6136f4e2289f8c67e422097f5e10dfe
parent: d4927c2459db577f54a91aa9c928c75642568cce
author: Paul Brossier <piem@piem.org>
date: Thu Dec 20 17:35:07 EST 2018

[py] avoid resizing py-source output

Make sure a copy of the source output is taken before resizing it.

--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -573,7 +573,9 @@
       return vec;
     } else if (PyLong_AsLong(size) > 0) {
       // short read, return a shorter array
-      PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0);
+      PyArrayObject *shortread = (PyArrayObject*)
+        PyArray_FROM_OTF(PyTuple_GetItem(done, 0), NPY_NOTYPE,
+            NPY_ARRAY_ENSURECOPY);
       PyArray_Dims newdims;
       PyObject *reshaped;
       newdims.len = PyArray_NDIM(shortread);