https://github.com/python/cpython/commit/4599335a83a22cf73a0c20e3692c29fd0278d23b
commit: 4599335a83a22cf73a0c20e3692c29fd0278d23b
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-04-30T10:05:48Z
summary:

gh-149122: Fix refleak in codegen (GH-149179)

files:
M Python/codegen.c

diff --git a/Python/codegen.c b/Python/codegen.c
index a371bf332b6d9e..a77451152c6039 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -3962,8 +3962,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);
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to