diff options
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 13a5ef12f..360f801e3 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -4693,9 +4693,16 @@ _check_axis(PyArrayObject *arr, int *axis, int flags) int n = arr->nd; if ((*axis >= MAX_DIMS) || (n==0)) { - temp = PyArray_Ravel(arr,0); - if (temp) *axis = PyArray_NDIM(temp)-1; - else *axis = 0; + if (n != 1) { + temp = PyArray_Ravel(arr,0); + if (temp) *axis = PyArray_NDIM(temp)-1; + else *axis = 0; + } + else { + temp = (PyObject *)arr; + Py_INCREF(temp); + *axis = 0; + } return temp; } else { |