diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-10-11 19:10:51 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-10-11 19:10:51 +0000 |
commit | 87e301093842c6ec1a47e0c8bf4f28c7fc164455 (patch) | |
tree | af301b540173402254a9884181ac16af36a7da27 | |
parent | d6c1b18483f22c40abb5ae040476491b932ca6e0 (diff) | |
download | numpy-87e301093842c6ec1a47e0c8bf4f28c7fc164455.tar.gz |
Make (type,()) return type
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 015f84671..3daf764c4 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -4249,9 +4249,10 @@ _convert_from_tuple(PyObject *obj) "invalid shape in fixed-type tuple."); goto fail; } - /* If (type, 1) was given, it is equivalent to type... */ - if (shape.len == 1 && shape.ptr[0] == 1 && \ - PyNumber_Check(val)) { + /* If (type, 1) was given, it is equivalent to type... + or (type, ()) was given it is equivalent to type... */ + if ((shape.len == 1 && shape.ptr[0] == 1 && PyNumber_Check(val)) || \ + (shape.len == 0 && PyTuple_Check(val))) { PyDimMem_FREE(shape.ptr); return type; } |