From b09ae3ff43111a336c0b706ea32fa07f88c992d9 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Silva Date: Thu, 26 Mar 2020 09:47:45 -0300 Subject: [PATCH] bpo-40071: Fix refleak in _functools module (GH19172) --- Modules/_functoolsmodule.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 2e27d48b147..dbe022e91d1 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -1424,9 +1424,11 @@ _functools_exec(PyObject *module) &lru_cache_type }; - kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); if (!kwd_mark) { - return -1; + kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); + if (!kwd_mark) { + return -1; + } } for (size_t i = 0; i < Py_ARRAY_LENGTH(typelist); i++) {