Skip to content

Commit

Permalink
[3.13] Free arena on _PyCompile_AstOptimize failure in Py_CompileStri…
Browse files Browse the repository at this point in the history
…ngObject (GH-128006)

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

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

(cherry picked from commit cfeaa99)

Co-authored-by: Berker Peksag <[email protected]>
  • Loading branch information
miss-islington and berkerpeksag authored Dec 16, 2024
1 parent 71a1e79 commit 367ea89
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 367ea89

Please sign in to comment.