Skip to content

Commit

Permalink
Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (
Browse files Browse the repository at this point in the history
pythonGH-127910)

After commit 10a91d7 introduced arena cleanup, commit 2dfbd4f
removed the free call when _PyCompile_AstOptimize fails.
  • Loading branch information
berkerpeksag authored and srinivasreddy committed Jan 8, 2025
1 parent 458bf0f commit 19fe095
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 @@ -1486,6 +1486,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 19fe095

Please sign in to comment.