[Python-checkins] bpo-40071: Fix refleak in _functools module (GH19172)

Paulo Henrique Silva webhook-mailer at python.org
Thu Mar 26 08:47:55 EDT 2020


https://github.com/python/cpython/commit/b09ae3ff43111a336c0b706ea32fa07f88c992d9
commit: b09ae3ff43111a336c0b706ea32fa07f88c992d9
branch: master
author: Paulo Henrique Silva <ph.silva at carta.com>
committer: GitHub <noreply at github.com>
date: 2020-03-26T13:47:45+01:00
summary:

bpo-40071: Fix refleak in _functools module (GH19172)

files:
M Modules/_functoolsmodule.c

diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 2e27d48b14753..dbe022e91d18f 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++) {



More information about the Python-checkins mailing list