From 45f4ca46d3f745d6b6fb6e123ef11a53c486ddfd Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Tue, 16 Feb 2021 23:17:51 -0600 Subject: [PATCH] BUG: Fix refcount leak in f2py `complex_double_from_pyobj` --- numpy/f2py/cfuncs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 40496ccf10cd..974062f2617a 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -1023,6 +1023,7 @@ } (*v).r = ((npy_cdouble *)PyArray_DATA(arr))->real; (*v).i = ((npy_cdouble *)PyArray_DATA(arr))->imag; + Py_DECREF(arr); return 1; } /* Python does not provide PyNumber_Complex function :-( */