Skip to content

Commit 3d04c8f

Browse files
committed
gh-113602: Bail out when the parser tries to override existing errors
1 parent 471aa75 commit 3d04c8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Parser/pegen_errors.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
311311
Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
312312
const char *errmsg, va_list va)
313313
{
314+
// Bail out if we already have an error set.
315+
if (p->error_indicator && PyErr_Occurred()) {
316+
return NULL;
317+
}
314318
PyObject *value = NULL;
315319
PyObject *errstr = NULL;
316320
PyObject *error_line = NULL;

0 commit comments

Comments
 (0)