Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-104482: Fix error handling bugs in ast.c #104483

Merged
merged 11 commits into from
May 15, 2023
7 changes: 6 additions & 1 deletion Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,9 @@ validate_pattern(struct validator *state, pattern_ty p, int star_ok)
break;
}
}

if (ret == 0) {
break;
}
ret = validate_patterns(state, p->v.MatchMapping.patterns, /*star_ok=*/0);
break;
case MatchClass_kind:
Expand Down Expand Up @@ -620,6 +622,9 @@ validate_pattern(struct validator *state, pattern_ty p, int star_ok)
}
}

iritkatriel marked this conversation as resolved.
Show resolved Hide resolved
if (ret == 0) {
break;
}
carljm marked this conversation as resolved.
Show resolved Hide resolved
if (!validate_patterns(state, p->v.MatchClass.patterns, /*star_ok=*/0)) {
ret = 0;
break;
Expand Down
1 change: 1 addition & 0 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ PyCodeObject *
_PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *pflags,
int optimize, PyArena *arena)
{
assert(!PyErr_Occurred());
iritkatriel marked this conversation as resolved.
Show resolved Hide resolved
struct compiler *c = new_compiler(mod, filename, pflags, optimize, arena);
if (c == NULL) {
return NULL;
Expand Down