From c6fdddeddbbe176ada161955094739998ff15272 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Tue, 27 Jul 2021 14:47:23 -0700 Subject: BUG: Fix `signature_tuple` refcount in ufunc loop registration --- numpy/core/src/umath/ufunc_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy') diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index c2554bd2e..5a32ae603 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -5560,6 +5560,8 @@ PyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, goto fail; } } + /* Clearing sets it to NULL for the error paths */ + Py_CLEAR(signature_tuple); funcdata->func = function; funcdata->arg_types = newtypes; @@ -5630,7 +5632,6 @@ PyUFunc_RegisterLoopForType(PyUFuncObject *ufunc, } } Py_DECREF(key); - Py_DECREF(signature_tuple); return 0; fail: -- cgit v1.2.1