]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-149122: Fix refleak in codegen (GH-149179) (#149181)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 30 Apr 2026 13:12:52 +0000 (15:12 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Apr 2026 13:12:52 +0000 (18:42 +0530)
gh-149122: Fix refleak in codegen (GH-149179)
(cherry picked from commit 4599335a83a22cf73a0c20e3692c29fd0278d23b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Python/codegen.c

index 3ce7220bcb6adf099d5acb548aa5556bb1cb2fc9..766d54d069927ecc580d8af8fd6946495cc813eb 100644 (file)
@@ -3864,8 +3864,10 @@ maybe_optimize_function_call(compiler *c, expr_ty e, jump_target_label end)
     expr_ty generator_exp = asdl_seq_GET(args, 0);
     PySTEntryObject *generator_entry = _PySymtable_Lookup(SYMTABLE(c), (void *)generator_exp);
     if (generator_entry->ste_coroutine) {
+        Py_DECREF(generator_entry);
         return 0;
     }
+    Py_DECREF(generator_entry);
 
     location loc = LOC(func);