Changeset 8b7cdba for python/ext/py-source.c
- Timestamp:
- Feb 27, 2017, 5:21:34 PM (8 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-source.c
r410a157 r8b7cdba 311 311 return vec; 312 312 } else if (PyLong_AsLong(size) > 0) { 313 // short read 313 // short read, return a shorter array 314 314 PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0); 315 315 PyArray_Dims newdims; 316 PyObject *reshaped; 316 317 newdims.len = PyArray_NDIM(shortread); 317 318 newdims.ptr = PyArray_DIMS(shortread); … … 322 323 newdims.ptr[1] = PyLong_AsLong(size); 323 324 } 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; 326 328 } else { 327 329 PyErr_SetNone(PyExc_StopIteration);
Note: See TracChangeset
for help on using the changeset viewer.