summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
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