diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2015-10-27 14:43:28 -0600 |
|---|---|---|
| committer | Charles Harris <charlesr.harris@gmail.com> | 2015-10-27 14:43:28 -0600 |
| commit | c0e48cfbbdef9cca954b0c4edd0052e1ec8a30aa (patch) | |
| tree | f5652bbc53cbe8a915bff9ec39789dabedc5f3c6 /numpy/core/src | |
| parent | 522a0f749d1ac8d0acece68f9c65d46e96529407 (diff) | |
| parent | 4d9bf8a3aa2f2bfe37e1e32fb036fafa156a6d38 (diff) | |
| download | numpy-c0e48cfbbdef9cca954b0c4edd0052e1ec8a30aa.tar.gz | |
Merge pull request #6553 from yashmehrotra/partition-fix
BUG: Fix partition and argpartition error for empty input. Closes #6530
Diffstat (limited to 'numpy/core/src')
| -rw-r--r-- | numpy/core/src/multiarray/item_selection.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index ec0717bd6..64fa70b6d 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -809,7 +809,7 @@ _new_sortlike(PyArrayObject *op, int axis, PyArray_SortFunc *sort, PyArrayIterObject *it; npy_intp size; - int ret = -1; + int ret = 0; NPY_BEGIN_THREADS_DEF; @@ -829,6 +829,7 @@ _new_sortlike(PyArrayObject *op, int axis, PyArray_SortFunc *sort, if (needcopy) { buffer = PyDataMem_NEW(N * elsize); if (buffer == NULL) { + ret = -1; goto fail; } } @@ -947,7 +948,7 @@ _new_argsortlike(PyArrayObject *op, int axis, PyArray_ArgSortFunc *argsort, PyArrayIterObject *it, *rit; npy_intp size; - int ret = -1; + int ret = 0; NPY_BEGIN_THREADS_DEF; @@ -969,6 +970,7 @@ _new_argsortlike(PyArrayObject *op, int axis, PyArray_ArgSortFunc *argsort, it = (PyArrayIterObject *)PyArray_IterAllButAxis((PyObject *)op, &axis); rit = (PyArrayIterObject *)PyArray_IterAllButAxis((PyObject *)rop, &axis); if (it == NULL || rit == NULL) { + ret = -1; goto fail; } size = it->size; @@ -978,6 +980,7 @@ _new_argsortlike(PyArrayObject *op, int axis, PyArray_ArgSortFunc *argsort, if (needcopy) { valbuffer = PyDataMem_NEW(N * elsize); if (valbuffer == NULL) { + ret = -1; goto fail; } } @@ -985,6 +988,7 @@ _new_argsortlike(PyArrayObject *op, int axis, PyArray_ArgSortFunc *argsort, if (needidxbuffer) { idxbuffer = (npy_intp *)PyDataMem_NEW(N * sizeof(npy_intp)); if (idxbuffer == NULL) { + ret = -1; goto fail; } } |
