Repository navigation
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
Description
Bug report
Code:
Lines 1683 to 1697 in 12ed8b1
| compiler *c = new_compiler(mod, filename, pflags, optimize, arena, NULL); | |
| if (c == NULL) { | |
| _PyArena_Free(arena); | |
| return NULL; | |
| } | |
| c->c_save_nested_seqs = true; | |
| metadata = PyDict_New(); | |
| if (metadata == NULL) { | |
| return NULL; | |
| } | |
| if (compiler_codegen(c, mod) < 0) { | |
| goto finally; | |
| } |
The problematic part is:
Lines 1690 to 1693 in 12ed8b1
| metadata = PyDict_New(); | |
| if (metadata == NULL) { | |
| return NULL; | |
| } |
It just returns NULL: does not free the compiler on error, does not free the arena, etc. It should be goto finally.
I have a PR ready.
Linked PRs
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
Activity
gh-153252: Fix error handling in `_PyCompile_CodeGen` (#153253)
[3.13] gh-153252: Fix error handling in `_PyCompile_CodeGen` (GH-153253…
[3.15] gh-153252: Fix error handling in `_PyCompile_CodeGen` (GH-153253…
[3.14] gh-153252: Fix error handling in `_PyCompile_CodeGen` (GH-153253…