Changeset 8b7cdba for python/ext


Ignore:
Timestamp:
Feb 27, 2017, 5:21:34 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
Children:
fcb6e8c
Parents:
410a157
Message:

python/ext/py-source.c: use PyArray_NewShape, not _Resize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-source.c

    r410a157 r8b7cdba  
    311311      return vec;
    312312    } else if (PyLong_AsLong(size) > 0) {
    313       // short read
     313      // short read, return a shorter array
    314314      PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0);
    315315      PyArray_Dims newdims;
     316      PyObject *reshaped;
    316317      newdims.len = PyArray_NDIM(shortread);
    317318      newdims.ptr = PyArray_DIMS(shortread);
     
    322323        newdims.ptr[1] = PyLong_AsLong(size);
    323324      }
    324       PyArray_Resize(shortread, &newdims, 1, NPY_ANYORDER);
    325       return (PyObject*)shortread;
     325      reshaped = PyArray_Newshape(shortread, &newdims, NPY_CORDER);
     326      Py_DECREF(shortread);
     327      return reshaped;
    326328    } else {
    327329      PyErr_SetNone(PyExc_StopIteration);
Note: See TracChangeset for help on using the changeset viewer.