From 07bdddd17c9953d9ce4e5ebe1cceda9e21eb855d Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Mon, 6 Mar 2006 04:20:01 +0000 Subject: Fix bad substitution of PyArray_New --- numpy/core/src/arrayobject.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'numpy/core/src/arrayobject.c') 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, -- cgit v1.2.1