summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-01-02 13:00:52 (GMT)
committerGitHub <noreply@github.com>2024-01-02 13:00:52 (GMT)
commit9ed36d533ab8b256f0a589b5be6d7a2fdcf4aff2 (patch)
tree3e0d85fc07933c7094a1e9d5fc48c48be27ab07d /Parser
parent8ff44f855450244d965dbf82c7f0a31de666007c (diff)
downloadcpython-9ed36d533ab8b256f0a589b5be6d7a2fdcf4aff2.zip
cpython-9ed36d533ab8b256f0a589b5be6d7a2fdcf4aff2.tar.gz
cpython-9ed36d533ab8b256f0a589b5be6d7a2fdcf4aff2.tar.bz2
gh-113602: Bail out when the parser tries to override existing errors (#113607)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Diffstat (limited to 'Parser')
-rw-r--r--Parser/pegen_errors.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Parser/pegen_errors.c b/Parser/pegen_errors.c
index 8a02aab..e15673d 100644
--- a/Parser/pegen_errors.c
+++ b/Parser/pegen_errors.c
@@ -311,6 +311,10 @@ _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
Py_ssize_t end_lineno, Py_ssize_t end_col_offset,
const char *errmsg, va_list va)
{
+ // Bail out if we already have an error set.
+ if (p->error_indicator && PyErr_Occurred()) {
+ return NULL;
+ }
PyObject *value = NULL;
PyObject *errstr = NULL;
PyObject *error_line = NULL;