]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40334: Set error_indicator in _PyPegen_raise_error (GH-19887)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Mon, 4 May 2020 00:20:09 +0000 (03:20 +0300)
committerGitHub <noreply@github.com>
Mon, 4 May 2020 00:20:09 +0000 (01:20 +0100)
Due to PyErr_Occurred not being called at the beginning of each rule, we need to set the error indicator, so that rules do not get expanded after an exception has been thrown

Parser/pegen/pegen.c

index 6ff09b3b31f783d04bea4196b08bf79e85d727f1..9858f71c83c790033f628c4512249a837341105b 100644 (file)
@@ -389,6 +389,7 @@ _PyPegen_raise_error(Parser *p, PyObject *errtype, int with_col_number, const ch
     Token *t = p->tokens[p->fill - 1];
     Py_ssize_t col_number = !with_col_number;
     va_list va;
+    p->error_indicator = 1;
 
     va_start(va, errmsg);
     errstr = PyUnicode_FromFormatV(errmsg, va);