From 8806030c6f06a39b830d029897fc539eea0d5a2b Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Fri, 25 Apr 2008 03:01:33 +0000 Subject: Fix ticket #736. Try to cast strings numeric types when numbers needed. --- numpy/core/src/arrayobject.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'numpy/core/src/arrayobject.c') diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 180f5ad0f..719bb5342 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -7479,11 +7479,8 @@ Array_FromSequence(PyObject *s, PyArray_Descr *typecode, int fortran, check_it = (typecode->type != PyArray_CHARLTR); - stop_at_string = ((type == PyArray_OBJECT) || - (type == PyArray_STRING && - typecode->type == PyArray_STRINGLTR) || - (type == PyArray_UNICODE) || - (type == PyArray_VOID)); + stop_at_string = (type != PyArray_STRING) || + (typecode->type == PyArray_STRINGLTR); stop_at_tuple = (type == PyArray_VOID && (typecode->names \ || typecode->subarray)); @@ -8613,7 +8610,7 @@ PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int min_depth, else if (newtype->type_num == PyArray_OBJECT) { isobject = 1; } - if (PySequence_Check(op)) { + if (!PyString_Check(op) && PySequence_Check(op)) { PyObject *thiserr = NULL; /* necessary but not sufficient */ -- cgit v1.2.1