bpo-43892: Make match patterns explicit in the AST (GH-25585)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3b0e59a..66a74cb 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -831,11 +831,7 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
if (arena == NULL)
goto error;
mod = PyAST_obj2mod(source, arena, compile_mode);
- if (mod == NULL) {
- _PyArena_Free(arena);
- goto error;
- }
- if (!_PyAST_Validate(mod)) {
+ if (mod == NULL || !_PyAST_Validate(mod)) {
_PyArena_Free(arena);
goto error;
}