summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-03-06 04:20:01 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-03-06 04:20:01 +0000
commit07bdddd17c9953d9ce4e5ebe1cceda9e21eb855d (patch)
treea8c0d8bf462716fed2088192d68e5e296147c70d /numpy/core/src/arrayobject.c
parentfe076fbbda80b494d6b0cde4511df83bddcddfe0 (diff)
downloadnumpy-07bdddd17c9953d9ce4e5ebe1cceda9e21eb855d.tar.gz
Fix bad substitution of PyArray_New
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 65443ecd9..e7aad394a 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -5431,8 +5431,14 @@ Array_FromScalar(PyObject *op, PyArray_Descr *typecode)
if (type == PyArray_UNICODE) itemsize *= 4;
}
- ret = (PyArrayObject *)PyArray_New(&PyArray_Type, 0, NULL, type,
- NULL, NULL, itemsize, 0, NULL);
+ if (itemsize != typecode->elsize) {
+ PyArray_DESCR_REPLACE(typecode);
+ typecode->elsize = itemsize;
+ }
+
+ ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, typecode,
+ 0, NULL,
+ NULL, NULL, 0, NULL);
if (ret == NULL) return NULL;
if (ret->nd > 0) {
PyErr_SetString(PyExc_ValueError,