diff options
author | Travis Oliphant <oliphant@enthought.com> | 2008-03-22 04:46:19 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2008-03-22 04:46:19 +0000 |
commit | 6e6c5c4fdb6548ef6eae953ce453a1a89c290fc1 (patch) | |
tree | 935c726049e8fa04bfdbb239dfa21fd0ca4d93ed /numpy | |
parent | 5696770c67bf565a6fbfbbd238b8a3339b6ca6c6 (diff) | |
download | numpy-6e6c5c4fdb6548ef6eae953ce453a1a89c290fc1.tar.gz |
Fix ticket #583 : error when using str as data-type for fromiter.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 21c6089e8..d62e28d58 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -6401,7 +6401,11 @@ PyArray_FromIter(PyObject *obj, PyArray_Descr *dtype, intp count) if (iter == NULL) goto done; elcount = (count < 0) ? 0 : count; - elsize = dtype->elsize; + if ((elsize=dtype->elsize) == 0) { + PyErr_SetString(PyExc_ValueError, "Must specify length "\ + "when using variable-size data-type."); + goto done; + } /* We would need to alter the memory RENEW code to decrement any reference counts before throwing away any memory. |