summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-09-05 16:58:59 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-09-05 16:58:59 +0000
commit341e0beb732f769887c7bb37fe01a5170602ee0a (patch)
tree53ac5fff84733cd1c26ecb0cdb3c9b559e3c01e3
parent1fcb79afad43182ce548c39fea4b5c4790f5958f (diff)
downloadnumpy-341e0beb732f769887c7bb37fe01a5170602ee0a.tar.gz
Fix dimension error for object arrays.
-rw-r--r--numpy/core/src/arrayobject.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index ee0afc9cc..dd96cee29 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -7157,15 +7157,20 @@ Array_FromSequence(PyObject *s, PyArray_Descr *typecode, int fortran,
int type = typecode->type_num;
int itemsize = typecode->elsize;
- stop_at_string = ((type == PyArray_OBJECT) || \
- (type == PyArray_STRING && \
- typecode->type == PyArray_STRINGLTR) || \
- (type == PyArray_UNICODE) || \
+ check_it = ((type != PyArray_STRING) &&
+ (type != PyArray_UNICODE) &&
+ (type != PyArray_VOID) &&
+ (type != PyArray_CHAR));
+
+ stop_at_string = ((type == PyArray_OBJECT) ||
+ (type == PyArray_STRING &&
+ typecode->type == PyArray_STRINGLTR) ||
+ (type == PyArray_UNICODE) ||
(type == PyArray_VOID));
-
+
stop_at_tuple = (type == PyArray_VOID && (typecode->names \
|| typecode->subarray));
-
+
if (!((nd=discover_depth(s, MAX_DIMS+1, stop_at_string,
stop_at_tuple)) > 0)) {
if (nd==0)
@@ -7186,7 +7191,6 @@ Array_FromSequence(PyObject *s, PyArray_Descr *typecode, int fortran,
goto fail;
}
- check_it = !(stop_at_string || type == PyArray_STRING);
if(discover_dimensions(s,nd,d, check_it) == -1) goto fail;
if (typecode->type == PyArray_CHARLTR && nd > 0 && d[nd-1]==1) {