Skip to content

Commit b63d475

Browse files
authored
Merge pull request numpy#22236 from seberg/fixup--21995
BUG: Fix incorrect refcounting in new `asarray` path
2 parents 4a9b714 + 3da24bb commit b63d475

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpy/core/src/multiarray/multiarraymodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1631,8 +1631,8 @@ _array_fromobject_generic(
16311631
oldtype = PyArray_DESCR(oparr);
16321632
if (PyArray_EquivTypes(oldtype, type)) {
16331633
if (copy != NPY_COPY_ALWAYS && STRIDING_OK(oparr, order)) {
1634-
Py_INCREF(op);
16351634
if (oldtype == type) {
1635+
Py_INCREF(op);
16361636
ret = oparr;
16371637
}
16381638
else {

0 commit comments

Comments
 (0)