diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c index 2e69b25f6d2c..145daa845c6f 100644 --- a/numpy/core/src/multiarray/arrayobject.c +++ b/numpy/core/src/multiarray/arrayobject.c @@ -243,6 +243,7 @@ PyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) else { if (PyArray_SIZE(dest) == 1) { Py_DECREF(dtype); + Py_DECREF(src_object); ret = PyArray_DESCR(dest)->f->setitem(src_object, PyArray_DATA(dest), dest); /* Unmask the value if necessary */