summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2019-01-09 15:00:45 +0100
committerSebastian Berg <sebastian@sipsolutions.net>2019-01-09 15:00:45 +0100
commita29e5859ab4bfd6a4b471601cca9f9b94d6dd80a (patch)
tree08c85964a3b930f01e96ad4afc66375c86cbd93b
parentae8a9793edc97041833248296198bdb880df89e6 (diff)
downloadnumpy-a29e5859ab4bfd6a4b471601cca9f9b94d6dd80a.tar.gz
BUG: Followup fixes of leaks detected with valgrind
See also gh-12624
-rw-r--r--numpy/core/src/multiarray/ctors.c1
-rw-r--r--numpy/core/tests/test_multiarray.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index bd70eba0c..acc4abac6 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -1410,6 +1410,7 @@ _array_from_buffer_3118(PyObject *memoryview)
* dimensions, so the array is now 0d.
*/
nd = 0;
+ Py_DECREF(descr);
descr = (PyArray_Descr *)PyObject_CallFunctionObjArgs(
(PyObject *)&PyArrayDescr_Type, Py_TYPE(view->obj), NULL);
if (descr == NULL) {
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 70cf74c4a..3bc2db90f 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -7211,6 +7211,7 @@ class TestConversion(object):
except NameError:
Error = RuntimeError # python < 3.5
assert_raises(Error, bool, self_containing) # previously stack overflow
+ self_containing[0] = None # resolve circular reference
def test_to_int_scalar(self):
# gh-9972 means that these aren't always the same