[3.13] Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-128006)

Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-127910)

After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36
removed the free call when _PyCompile_AstOptimize fails.

(cherry picked from commit cfeaa992ba)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
This commit is contained in:
Miss Islington (bot)
2024-12-16 22:26:39 +01:00
committed by GitHub
parent 71a1e79134
commit 367ea89384
+1
View File
@@ -1485,6 +1485,7 @@ Py_CompileStringObject(const char *str, PyObject *filename, int start,
if (flags && (flags->cf_flags & PyCF_ONLY_AST)) {
if ((flags->cf_flags & PyCF_OPTIMIZED_AST) == PyCF_OPTIMIZED_AST) {
if (_PyCompile_AstOptimize(mod, filename, flags, optimize, arena) < 0) {
_PyArena_Free(arena);
return NULL;
}
}