diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2022-09-09 11:51:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 11:51:42 +0300 |
commit | b63d475ace5e003e95cbb4844869e7a3c12ab54a (patch) | |
tree | b8f626a9716bc09ac4d1940a1c1046fdb5fd32cf /numpy | |
parent | 4a9b7145eb1a0731821eb8912c2474352cadc682 (diff) | |
parent | 3da24bb449c312e51086734cf935c0c661e1f95f (diff) | |
download | numpy-b63d475ace5e003e95cbb4844869e7a3c12ab54a.tar.gz |
Merge pull request #22236 from seberg/fixup--21995
BUG: Fix incorrect refcounting in new `asarray` path
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index f01752431..f8e7d37c3 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -1631,8 +1631,8 @@ _array_fromobject_generic( oldtype = PyArray_DESCR(oparr); if (PyArray_EquivTypes(oldtype, type)) { if (copy != NPY_COPY_ALWAYS && STRIDING_OK(oparr, order)) { - Py_INCREF(op); if (oldtype == type) { + Py_INCREF(op); ret = oparr; } else { |