diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-02-09 05:26:03 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-02-09 05:26:03 +0000 |
commit | fc7ac38dec262117bbc30698e0696e9911369207 (patch) | |
tree | dcbaf3acc96cb207647f2f5b9dcd2b378bbe5deb /numpy/core/src/arrayobject.c | |
parent | f1bffaafc8e94cb5e1e94bd0527410108903669c (diff) | |
download | numpy-fc7ac38dec262117bbc30698e0696e9911369207.tar.gz |
Fixed reference count problems.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 48ce04c52..76be69702 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -1313,7 +1313,7 @@ array_dealloc(PyArrayObject *self) { PyDimMem_FREE(self->dimensions); - Py_DECREF(self->descr); + Py_XDECREF(self->descr); self->ob_type->tp_free((PyObject *)self); } @@ -4507,7 +4507,9 @@ array_descr_set(PyArrayObject *self, PyObject *arg) dimensions, strides and descr from it */ PyArrayObject *temp; - temp = (PyArrayObject *)\ + /* We would decref newtype here --- temp will + steal a reference to it */ + temp = (PyArrayObject *) \ PyArray_NewFromDescr(&PyArray_Type, newtype, self->nd, self->dimensions, self->strides, self->data, self->flags, NULL); @@ -4515,9 +4517,8 @@ array_descr_set(PyArrayObject *self, PyObject *arg) self->dimensions = temp->dimensions; self->nd = temp->nd; self->strides = temp->strides; - Py_DECREF(newtype); newtype = temp->descr; - /* Fool deallocator */ + /* Fool deallocator not to delete these*/ temp->nd = 0; temp->dimensions = NULL; temp->descr = NULL; |