]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-149122: Fix refleak in codegen (GH-149179)
authorPetr Viktorin <encukou@gmail.com>
Thu, 30 Apr 2026 10:05:48 +0000 (12:05 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Apr 2026 10:05:48 +0000 (10:05 +0000)
Python/codegen.c

index a371bf332b6d9ebbb2f3671cba9c6595a5b7d4e1..a77451152c60394478635c5c16988ae6de67b441 100644 (file)
@@ -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);