Skip to content

Commit 3af4b58

Browse files
authored
bpo-42206: Propagate and raise errors from PyAST_Validate in the parser (GH-23035)
1 parent d6238ba commit 3af4b58

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Propagate and raise the errors caused by :c:func:`PyAST_Validate` in the
2+
parser.

Parser/pegen.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,9 @@ _PyPegen_run_parser(Parser *p)
11571157
p->start_rule == Py_file_input ||
11581158
p->start_rule == Py_eval_input)
11591159
{
1160-
assert(PyAST_Validate(res));
1160+
if (!PyAST_Validate(res)) {
1161+
return NULL;
1162+
}
11611163
}
11621164
#endif
11631165
return res;

0 commit comments

Comments
 (0)