diff options
author | Jaime Fernandez <jaime.frio@gmail.com> | 2015-04-22 20:36:13 -0700 |
---|---|---|
committer | Jaime Fernandez <jaime.frio@gmail.com> | 2015-04-22 20:36:13 -0700 |
commit | d73f23b092c3b44c279412c4833eb6bd953b713a (patch) | |
tree | 423292e6618c639bf0a2c5d5b6f6cca10c040775 | |
parent | 02b858326dac217607a83ed0bf4d7d51d5bfbfbe (diff) | |
download | numpy-d73f23b092c3b44c279412c4833eb6bd953b713a.tar.gz |
BUG: Fixed wrong return of PyArray_Partition on failure
On failure, PyArray_Partition should return -1, but was returning
NULL in a couple of unlikely cases.
-rw-r--r-- | numpy/core/src/multiarray/item_selection.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index c59a125e0..877887109 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -1230,7 +1230,7 @@ PyArray_Partition(PyArrayObject *op, PyArrayObject * ktharray, int axis, if (which < 0 || which >= NPY_NSELECTS) { PyErr_SetString(PyExc_ValueError, "not a valid partition kind"); - return NULL; + return -1; } part = get_partition_func(PyArray_TYPE(op), which); if (part == NULL) { @@ -1241,7 +1241,7 @@ PyArray_Partition(PyArrayObject *op, PyArrayObject * ktharray, int axis, else { PyErr_SetString(PyExc_TypeError, "type does not have compare function"); - return NULL; + return -1; } } |