From e0a836e3eba09bdad482121a0803c4ae3970ac6b Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 29 Aug 2026 05:14:29 -0700 Subject: [PATCH] [3.13] gh-156466: Fix additional compiler scope cleanup errors (GH-156547) (cherry picked from commit f4874f381c1ef9a3e0e17fde870f2d38d89e043b) Co-authored-by: Jelle Zijlstra --- Python/compile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Python/compile.c b/Python/compile.c index fa03bbd1afa9630..9151c29a9c1862d 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -7933,6 +7933,9 @@ _PyCompile_CodeGen(PyObject *ast, PyObject *filename, PyCompilerFlags *pflags, Py_XDECREF(consts_list); Py_XDECREF(metadata); compiler_exit_scope(c); + if (c->u != NULL) { + compiler_exit_scope(c); + } compiler_free(c); _PyArena_Free(arena); return res;