summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-05-23 20:25:31 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-05-23 20:25:31 +0000
commitb429ae58defaaccfc7aecf7b07d193a60da38d38 (patch)
tree0fa7857e8b461bcea80bf707864588ac21fa17a1 /numpy/core/src/arrayobject.c
parent8f0db8c41c17af95900c0cdfe71aa6916b5094c3 (diff)
downloadnumpy-b429ae58defaaccfc7aecf7b07d193a60da38d38.tar.gz
Properly decrement references for _internal.py imports
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index d86ec6171..e269195cc 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -6132,11 +6132,14 @@ static PyObject *
array_ctypes_get(PyArrayObject *self)
{
PyObject *_numpy_internal;
+ PyObject *ret;
_numpy_internal = PyImport_ImportModule("numpy.core._internal");
if (_numpy_internal == NULL) return NULL;
- return PyObject_CallMethod(_numpy_internal, "_ctypes",
- "ON", self,
- PyLong_FromVoidPtr(self->data));
+ ret = PyObject_CallMethod(_numpy_internal, "_ctypes",
+ "ON", self,
+ PyLong_FromVoidPtr(self->data));
+ Py_DECREF(_numpy_internal);
+ return ret;
}
static PyObject *
@@ -10864,8 +10867,10 @@ arraydescr_protocol_descr_get(PyArray_Descr *self)
_numpy_internal = PyImport_ImportModule("numpy.core._internal");
if (_numpy_internal == NULL) return NULL;
- return PyObject_CallMethod(_numpy_internal, "_array_descr",
- "O", self);
+ res = PyObject_CallMethod(_numpy_internal, "_array_descr",
+ "O", self);
+ Py_DECREF(_numpy_internal);
+ return res;
}
/* returns 1 for a builtin type