diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2008-04-25 03:01:33 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2008-04-25 03:01:33 +0000 |
commit | 8806030c6f06a39b830d029897fc539eea0d5a2b (patch) | |
tree | a67b261c445e990c0e42b67a3138d22469a6614e /numpy/core/src/arrayobject.c | |
parent | d78d0521093c70f66c1efbed9f1733782aa200f1 (diff) | |
download | numpy-8806030c6f06a39b830d029897fc539eea0d5a2b.tar.gz |
Fix ticket #736.
Try to cast strings numeric types when numbers needed.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 9 |
1 files changed, 3 insertions, 6 deletions
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 */ |