summaryrefslogtreecommitdiff
path: root/numpy/core/src/arraymethods.c
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src/arraymethods.c')
-rw-r--r--numpy/core/src/arraymethods.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c
index 26c45e839..3a1b0c37d 100644
--- a/numpy/core/src/arraymethods.c
+++ b/numpy/core/src/arraymethods.c
@@ -883,6 +883,7 @@ array_sort(PyArrayObject *self, PyObject *args, PyObject *kwds)
if (_numpy_internal == NULL) return NULL;
new_name = PyObject_CallMethod(_numpy_internal, "_newnames",
"OO", saved, order);
+ Py_DECREF(_numpy_internal);
if (new_name == NULL) return NULL;
newd = PyArray_DescrNew(saved);
newd->names = new_name;
@@ -928,6 +929,7 @@ array_argsort(PyArrayObject *self, PyObject *args, PyObject *kwds)
if (_numpy_internal == NULL) return NULL;
new_name = PyObject_CallMethod(_numpy_internal, "_newnames",
"OO", saved, order);
+ Py_DECREF(_numpy_internal);
if (new_name == NULL) return NULL;
newd = PyArray_DescrNew(saved);
newd->names = new_name;