diff options
author | Travis Oliphant <oliphant@enthought.com> | 2005-12-06 01:43:36 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2005-12-06 01:43:36 +0000 |
commit | 4a7ce99355e8a7860f9782a8f0900234c7fa96ee (patch) | |
tree | c4194cb21d4d2e68d5ad6b0fcf78cbe1259c138b /scipy/base/src/arrayobject.c | |
parent | bcd661e1bd0d478b22341079c7e5fb60c9353cfc (diff) | |
download | numpy-4a7ce99355e8a7860f9782a8f0900234c7fa96ee.tar.gz |
Fixed typo in cfuncs.py
Diffstat (limited to 'scipy/base/src/arrayobject.c')
-rw-r--r-- | scipy/base/src/arrayobject.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/scipy/base/src/arrayobject.c b/scipy/base/src/arrayobject.c index bbcd99a6b..4906ac0c7 100644 --- a/scipy/base/src/arrayobject.c +++ b/scipy/base/src/arrayobject.c @@ -51,7 +51,6 @@ PyArray_PyIntAsIntp(PyObject *o) } else if (PyArray_IsScalar(o, Integer)) { arr = PyArray_FromScalar(o, descr); - Py_DECREF(descr); } if (arr != NULL) { ret = *((intp *)PyArray_DATA(arr)); @@ -124,7 +123,6 @@ PyArray_PyIntAsInt(PyObject *o) } if (PyArray_IsScalar(o, Integer)) { arr = PyArray_FromScalar(o, descr); - Py_DECREF(descr); } if (arr != NULL) { ret = *((int *)PyArray_DATA(arr)); @@ -4219,16 +4217,7 @@ array_descr_set(PyArrayObject *self, PyObject *arg) temp->descr = NULL; Py_DECREF(temp); } - - if ((self->descr->elsize == newtype->elsize) && newtype->fields) { - PyArray_Descr *_thetype; - _thetype = PyArray_DescrNew(self->descr); - Py_XDECREF(_thetype->fields); - Py_INCREF(newtype->fields); - _thetype->fields = newtype->fields; - Py_DECREF(newtype); - newtype = _thetype; - } + self->descr = newtype; PyArray_UpdateFlags(self, UPDATE_ALL_FLAGS); @@ -6597,8 +6586,10 @@ iter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val) /* convert to INTP array if Integer array scalar or List */ indtype = PyArray_DescrFromType(PyArray_INTP); - if (PyArray_IsScalar(ind, Integer)) + if (PyArray_IsScalar(ind, Integer)) { + Py_INCREF(indtype); obj = PyArray_FromScalar(ind, indtype); + } else if (PyList_Check(ind)) { Py_INCREF(indtype); obj = PyArray_FromAny(ind, indtype, 0, 0, FORCECAST); |