summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorArink Verma <arinkverma@gmail.com>2013-07-08 23:06:03 +0530
committerArink Verma <arinkverma@gmail.com>2013-07-08 23:06:03 +0530
commit021d52a1294c662c7e31918db2e26bdc10e37f20 (patch)
tree1c1b5cf67aac18854833e2b5d64d1cd5d4d2b0ec /numpy
parent9b3e719b8ab153335bcc9064cf186c823367bdbe (diff)
downloadnumpy-021d52a1294c662c7e31918db2e26bdc10e37f20.tar.gz
ENH: added check for scalar array in PyArray_FromArray from ctors.c
Check if object is of array with newtype is NULL. If so return it directly instead of checking for casting.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/ctors.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index 49a4723ed..fb8d078c4 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -1798,11 +1798,10 @@ PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int flags)
oldtype = PyArray_DESCR(arr);
if (newtype == NULL) {
- /*
- * Check if object is of array dimension zero with Null newtype.
- * If so return it directly instead of calling PyArray_FromAny.
+ /* Check if object is of array with Null newtype.
+ * If so return it directly instead of checking for casting.
*/
- if (PyArray_NDIM(arr) == 0 && flags == 0) {
+ if (flags == 0) {
Py_INCREF(arr);
return (PyObject *)arr;
}