Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a7e61c

Browse files
Christopher L. Farrowcharris
authored andcommitted
BUG: Fixed reference count bug where scalar value assignment by field to an array would increment the reference count of the scalar.
1 parent be52978 commit 3a7e61c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

numpy/core/src/multiarray/arrayobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ PyArray_CopyObject(PyArrayObject *dest, PyObject *src_object)
243243
else {
244244
if (PyArray_SIZE(dest) == 1) {
245245
Py_DECREF(dtype);
246+
Py_DECREF(src_object);
246247
ret = PyArray_DESCR(dest)->f->setitem(src_object,
247248
PyArray_DATA(dest), dest);
248249
/* Unmask the value if necessary */

0 commit comments

Comments
 (0)