]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-145783: Propagate errors raised in `NEW_TYPE_COMMENT` (GH-145784) (#145927)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Fri, 13 Mar 2026 18:07:45 +0000 (18:07 +0000)
committerGitHub <noreply@github.com>
Fri, 13 Mar 2026 18:07:45 +0000 (18:07 +0000)
Lib/test/test_type_comments.py
Misc/NEWS.d/next/Core_and_Builtins/2026-03-10-19-00-39.gh-issue-145783.dS5TM9.rst [new file with mode: 0644]
Modules/_testcapimodule.c
Parser/parser.c
Tools/peg_generator/pegen/c_generator.py

index ee8939f62d082cd29459cdfae68d165cb0d10e46..feb415bfc2a9d13ec3f83294d69d66bc908da7c4 100644 (file)
@@ -1,6 +1,7 @@
 import ast
 import sys
 import unittest
+from test.support import import_helper
 
 
 funcdef = """\
@@ -391,6 +392,13 @@ class TypeCommentTests(unittest.TestCase):
         check_both_ways("pass  # type: ignorewhatever\n")
         check_both_ways("pass  # type: ignoreĆ©\n")
 
+    def test_non_utf8_type_comment_with_ignore_cookie(self):
+        _testcapi = import_helper.import_module('_testcapi')
+        flags = 0x0800 | 0x1000 # PyCF_IGNORE_COOKIE | PyCF_TYPE_COMMENTS
+        with self.assertRaises(UnicodeDecodeError):
+            _testcapi.Py_CompileStringExFlags(
+                b"a=1 # type: \x80", "<test>", 256, flags)
+
     def test_func_type_input(self):
 
         def parse_func_type_input(source):
diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-10-19-00-39.gh-issue-145783.dS5TM9.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-10-19-00-39.gh-issue-145783.dS5TM9.rst
new file mode 100644 (file)
index 0000000..ce9aa28
--- /dev/null
@@ -0,0 +1,2 @@
+Fix an unlikely crash in the parser when certain errors were erroneously not
+propagated. Found by OSS Fuzz in :oss-fuzz:`491369109`.
index 72df72e9889ef549a78dd8971e06ff5a5dccc12e..77905a60225895a4a272fe180f3c6f6ea24a4b75 100644 (file)
@@ -331,6 +331,18 @@ pycompilestring(PyObject* self, PyObject *obj) {
     return Py_CompileString(the_string, "<string>", Py_file_input);
 }
 
+static PyObject*
+pycompilestringexflags(PyObject *self, PyObject *args) {
+    const char *the_string, *filename;
+    int start, flags;
+    if (!PyArg_ParseTuple(args, "ysii", &the_string, &filename, &start, &flags)) {
+        return NULL;
+    }
+    PyCompilerFlags cf = _PyCompilerFlags_INIT;
+    cf.cf_flags = flags;
+    return Py_CompileStringExFlags(the_string, filename, start, &cf, -1);
+}
+
 static PyObject*
 test_lazy_hash_inheritance(PyObject* self, PyObject *Py_UNUSED(ignored))
 {
@@ -3552,6 +3564,7 @@ static PyMethodDef TestMethods[] = {
     {"return_result_with_error", return_result_with_error, METH_NOARGS},
     {"getitem_with_error", getitem_with_error, METH_VARARGS},
     {"Py_CompileString",     pycompilestring, METH_O},
+    {"Py_CompileStringExFlags", pycompilestringexflags, METH_VARARGS},
     {"dict_get_version", dict_get_version, METH_VARARGS},
     {"raise_SIGINT_then_send_None", raise_SIGINT_then_send_None, METH_VARARGS},
     {"stack_pointer", stack_pointer, METH_NOARGS},
index cb43d5c5c3234f3028c9a954d40673d5f4f5dffd..c91f85fcd5cefce12630b1dede1aaec2156c1c92 100644 (file)
@@ -1176,7 +1176,7 @@ file_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ file[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statements? $"));
             _res = _PyPegen_make_module ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1219,7 +1219,7 @@ interactive_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ interactive[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement_newline"));
             _res = _PyAST_Interactive ( a , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1268,7 +1268,7 @@ eval_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ eval[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions NEWLINE* $"));
             _res = _PyAST_Expression ( a , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1329,7 +1329,7 @@ func_type_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ func_type[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $"));
             _res = _PyAST_FunctionType ( a , b , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1372,7 +1372,7 @@ statements_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
             _res = ( asdl_stmt_seq* ) _PyPegen_seq_flatten ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1415,7 +1415,7 @@ statement_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt"));
             _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1439,7 +1439,7 @@ statement_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ statement[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1494,7 +1494,7 @@ statement_newline_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "compound_stmt NEWLINE"));
             _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1546,7 +1546,7 @@ statement_newline_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , CHECK ( stmt_ty , _PyAST_Pass ( EXTRA ) ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1570,7 +1570,7 @@ statement_newline_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ statement_newline[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "$"));
             _res = _PyPegen_interactive_exit ( p );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1618,7 +1618,7 @@ simple_stmts_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt !';' NEWLINE"));
             _res = ( asdl_stmt_seq* ) _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1649,7 +1649,7 @@ simple_stmts_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ simple_stmts[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'.simple_stmt+ ';'? NEWLINE"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1768,7 +1768,7 @@ simple_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Expr ( e , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1864,7 +1864,7 @@ simple_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Pass ( EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1960,7 +1960,7 @@ simple_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Break ( EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -1993,7 +1993,7 @@ simple_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Continue ( EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2304,7 +2304,7 @@ assignment_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotation syntax is" , _PyAST_AnnAssign ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2346,7 +2346,7 @@ assignment_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 6 , "Variable annotations syntax is" , _PyAST_AnnAssign ( a , b , c , 0 , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2387,7 +2387,7 @@ assignment_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2429,7 +2429,7 @@ assignment_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_AugAssign ( a , b -> kind , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2565,7 +2565,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+='"));
             _res = _PyPegen_augoperator ( p , Add );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2589,7 +2589,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-='"));
             _res = _PyPegen_augoperator ( p , Sub );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2613,7 +2613,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*='"));
             _res = _PyPegen_augoperator ( p , Mult );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2637,7 +2637,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@='"));
             _res = CHECK_VERSION ( AugOperator* , 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2661,7 +2661,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'/='"));
             _res = _PyPegen_augoperator ( p , Div );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2685,7 +2685,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'%='"));
             _res = _PyPegen_augoperator ( p , Mod );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2709,7 +2709,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'&='"));
             _res = _PyPegen_augoperator ( p , BitAnd );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2733,7 +2733,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|='"));
             _res = _PyPegen_augoperator ( p , BitOr );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2757,7 +2757,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'^='"));
             _res = _PyPegen_augoperator ( p , BitXor );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2781,7 +2781,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<<='"));
             _res = _PyPegen_augoperator ( p , LShift );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2805,7 +2805,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>>='"));
             _res = _PyPegen_augoperator ( p , RShift );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2829,7 +2829,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**='"));
             _res = _PyPegen_augoperator ( p , Pow );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2853,7 +2853,7 @@ augassign_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ augassign[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'//='"));
             _res = _PyPegen_augoperator ( p , FloorDiv );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2917,7 +2917,7 @@ return_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Return ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -2984,7 +2984,7 @@ raise_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Raise ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3017,7 +3017,7 @@ raise_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Raise ( NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3081,7 +3081,7 @@ global_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Global ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3145,7 +3145,7 @@ nonlocal_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3211,7 +3211,7 @@ del_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Delete ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3291,7 +3291,7 @@ yield_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Expr ( y , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3358,7 +3358,7 @@ assert_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Assert ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3498,7 +3498,7 @@ import_name_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Import ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3573,7 +3573,7 @@ import_from_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_checked_future_import ( p , b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3615,7 +3615,7 @@ import_from_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3681,7 +3681,7 @@ import_from_targets_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' import_from_as_names ','? ')'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3735,7 +3735,7 @@ import_from_targets_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = ( asdl_alias_seq* ) _PyPegen_singleton_seq ( p , CHECK ( alias_ty , _PyPegen_alias_for_star ( p , EXTRA ) ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3797,7 +3797,7 @@ import_from_as_names_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3861,7 +3861,7 @@ import_from_as_name_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3904,7 +3904,7 @@ dotted_as_names_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -3968,7 +3968,7 @@ dotted_as_name_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4053,7 +4053,7 @@ dotted_name_raw(Parser *p)
         {
             D(fprintf(stderr, "%*c+ dotted_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name '.' NAME"));
             _res = _PyPegen_join_names_with_dot ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4128,7 +4128,7 @@ block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4210,7 +4210,7 @@ decorators_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4256,7 +4256,7 @@ class_def_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
             _res = _PyPegen_class_def_decorators ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4372,7 +4372,7 @@ class_def_raw_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , t , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4418,7 +4418,7 @@ function_def_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
             _res = _PyPegen_function_def_decorators ( p , d , f );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4547,7 +4547,7 @@ function_def_raw_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4610,7 +4610,7 @@ function_def_raw_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , t , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4724,7 +4724,7 @@ parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
             _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4754,7 +4754,7 @@ parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
             _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4784,7 +4784,7 @@ parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
             _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4811,7 +4811,7 @@ parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
             _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4835,7 +4835,7 @@ parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
             _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4884,7 +4884,7 @@ slash_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4913,7 +4913,7 @@ slash_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4967,7 +4967,7 @@ slash_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
             _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -4999,7 +4999,7 @@ slash_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
             _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5075,7 +5075,7 @@ star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
             _res = _PyPegen_star_etc ( p , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5108,7 +5108,7 @@ star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default_star_annotation param_maybe_default* kwds?"));
             _res = _PyPegen_star_etc ( p , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5141,7 +5141,7 @@ star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
             _res = _PyPegen_star_etc ( p , NULL , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5165,7 +5165,7 @@ star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
             _res = _PyPegen_star_etc ( p , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5230,7 +5230,7 @@ kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5279,7 +5279,7 @@ param_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
             _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5308,7 +5308,7 @@ param_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
             _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5359,7 +5359,7 @@ param_no_default_star_annotation_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation ',' TYPE_COMMENT?"));
             _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5388,7 +5388,7 @@ param_no_default_star_annotation_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_no_default_star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_star_annotation TYPE_COMMENT? &')'"));
             _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5440,7 +5440,7 @@ param_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
             _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5472,7 +5472,7 @@ param_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
             _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5526,7 +5526,7 @@ param_maybe_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
             _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5558,7 +5558,7 @@ param_maybe_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
             _res = _PyPegen_name_default_pair ( p , a , c , tc );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5622,7 +5622,7 @@ param_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5686,7 +5686,7 @@ param_star_annotation_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5732,7 +5732,7 @@ annotation_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5778,7 +5778,7 @@ star_annotation_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' star_expression"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5824,7 +5824,7 @@ default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5938,7 +5938,7 @@ if_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -5983,7 +5983,7 @@ if_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_If ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6078,7 +6078,7 @@ elif_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_If ( a , b , CHECK ( asdl_stmt_seq* , _PyPegen_singleton_seq ( p , c ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6123,7 +6123,7 @@ elif_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_If ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6191,7 +6191,7 @@ else_block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ else_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' &&':' block"));
             _res = b;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6283,7 +6283,7 @@ while_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_While ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6391,7 +6391,7 @@ for_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6455,7 +6455,7 @@ for_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 5 , "Async for loops are" , _PyAST_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6586,7 +6586,7 @@ with_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6631,7 +6631,7 @@ with_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6686,7 +6686,7 @@ with_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NULL , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6734,7 +6734,7 @@ with_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 5 , "Async with statements are" , _PyAST_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6807,7 +6807,7 @@ with_item_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
             _res = _PyAST_withitem ( e , t , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6850,7 +6850,7 @@ with_item_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
             _res = _PyAST_withitem ( e , NULL , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6943,7 +6943,7 @@ try_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Try ( b , NULL , NULL , f , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -6991,7 +6991,7 @@ try_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Try ( b , ex , el , f , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7039,7 +7039,7 @@ try_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 11 , "Exception groups are" , _PyAST_TryStar ( b , ex , el , f , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7135,7 +7135,7 @@ except_block_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7174,7 +7174,7 @@ except_block_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ExceptHandler ( NULL , NULL , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7291,7 +7291,7 @@ except_star_block_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7378,7 +7378,7 @@ finally_block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ finally_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' &&':' block"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7459,7 +7459,7 @@ match_stmt_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 10 , "Pattern matching is" , _PyAST_Match ( subject , cases , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7545,7 +7545,7 @@ subject_expr_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , value , values ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7638,7 +7638,7 @@ case_block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' block"));
             _res = _PyAST_match_case ( pattern , guard , body , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7684,7 +7684,7 @@ guard_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ guard[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression"));
             _res = guard;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7745,7 +7745,7 @@ patterns_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchSequence ( patterns , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7888,7 +7888,7 @@ as_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchAs ( pattern , target -> v . Name . id , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -7968,7 +7968,7 @@ or_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = asdl_seq_LEN ( patterns ) == 1 ? asdl_seq_GET ( patterns , 0 ) : _PyAST_MatchOr ( patterns , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8221,7 +8221,7 @@ literal_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchValue ( value , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8254,7 +8254,7 @@ literal_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchValue ( value , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8287,7 +8287,7 @@ literal_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchValue ( value , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8320,7 +8320,7 @@ literal_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchSingleton ( Py_None , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8353,7 +8353,7 @@ literal_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchSingleton ( Py_True , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8386,7 +8386,7 @@ literal_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchSingleton ( Py_False , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8512,7 +8512,7 @@ literal_expr_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_None , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8545,7 +8545,7 @@ literal_expr_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_True , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8578,7 +8578,7 @@ literal_expr_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_False , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8647,7 +8647,7 @@ complex_number_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( real , Add , imag , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8686,7 +8686,7 @@ complex_number_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( real , Sub , imag , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8769,7 +8769,7 @@ signed_number_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_UnaryOp ( USub , number , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8852,7 +8852,7 @@ signed_real_number_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_UnaryOp ( USub , real , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8895,7 +8895,7 @@ real_number_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ real_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
             _res = _PyPegen_ensure_real ( p , real );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8938,7 +8938,7 @@ imaginary_number_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ imaginary_number[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NUMBER"));
             _res = _PyPegen_ensure_imaginary ( p , imag );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -8999,7 +8999,7 @@ capture_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchAs ( NULL , target -> v . Name . id , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9046,7 +9046,7 @@ pattern_capture_target_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
             _res = _PyPegen_set_expr_context ( p , name , Store );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9107,7 +9107,7 @@ wildcard_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchAs ( NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9170,7 +9170,7 @@ value_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchValue ( attr , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9273,7 +9273,7 @@ attr_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Attribute ( value , attr -> v . Name . id , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9380,7 +9380,7 @@ group_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ group_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' pattern ')'"));
             _res = pattern;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9447,7 +9447,7 @@ sequence_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchSequence ( patterns , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9486,7 +9486,7 @@ sequence_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchSequence ( patterns , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9535,7 +9535,7 @@ open_sequence_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ open_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern ',' maybe_sequence_pattern?"));
             _res = _PyPegen_seq_insert_in_front ( p , pattern , patterns );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9582,7 +9582,7 @@ maybe_sequence_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ maybe_sequence_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.maybe_star_pattern+ ','?"));
             _res = patterns;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9707,7 +9707,7 @@ star_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchStar ( target -> v . Name . id , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9743,7 +9743,7 @@ star_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchStar ( NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9812,7 +9812,7 @@ mapping_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchMapping ( NULL , NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9855,7 +9855,7 @@ mapping_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchMapping ( NULL , NULL , rest -> v . Name . id , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9904,7 +9904,7 @@ mapping_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , rest -> v . Name . id , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -9947,7 +9947,7 @@ mapping_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchMapping ( CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , items ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , items ) ) , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10034,7 +10034,7 @@ key_value_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ key_value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(literal_expr | attr) ':' pattern"));
             _res = _PyPegen_key_pattern_pair ( p , key , pattern );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10080,7 +10080,7 @@ double_star_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ double_star_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' pattern_capture_target"));
             _res = target;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10152,7 +10152,7 @@ class_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchClass ( cls , NULL , NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10198,7 +10198,7 @@ class_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchClass ( cls , patterns , NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10244,7 +10244,7 @@ class_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchClass ( cls , NULL , CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10296,7 +10296,7 @@ class_pattern_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_MatchClass ( cls , patterns , CHECK ( asdl_identifier_seq* , _PyPegen_map_names_to_ids ( p , CHECK ( asdl_expr_seq* , _PyPegen_get_pattern_keys ( p , keywords ) ) ) ) , CHECK ( asdl_pattern_seq* , _PyPegen_get_patterns ( p , keywords ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10358,7 +10358,7 @@ positional_patterns_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
             _res = args;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10445,7 +10445,7 @@ keyword_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ keyword_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' pattern"));
             _res = _PyPegen_key_pattern_pair ( p , arg , value );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10518,7 +10518,7 @@ type_alias_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( stmt_ty , 12 , "Type statement is" , _PyAST_TypeAlias ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , n , Store ) ) , t , b , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10586,7 +10586,7 @@ type_params_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' type_param_seq ']'"));
             _res = CHECK_VERSION ( asdl_type_param_seq* , 12 , "Type parameter lists are" , t );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10633,7 +10633,7 @@ type_param_seq_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_param_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.type_param+ ','?"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10709,7 +10709,7 @@ type_param_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_TypeVar ( a -> v . Name . id , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10742,7 +10742,7 @@ type_param_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' NAME ':' expression"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with TypeVarTuple" : "cannot use bound with TypeVarTuple" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10781,7 +10781,7 @@ type_param_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_TypeVarTuple ( a -> v . Name . id , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10814,7 +10814,7 @@ type_param_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' NAME ':' expression"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( colon , e -> kind == Tuple_kind ? "cannot use constraints with ParamSpec" : "cannot use bound with ParamSpec" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10853,7 +10853,7 @@ type_param_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ParamSpec ( a -> v . Name . id , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10900,7 +10900,7 @@ type_param_bound_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_param_bound[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
             _res = e;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10946,7 +10946,7 @@ type_param_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_param_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
             _res = CHECK_VERSION ( expr_ty , 13 , "Type parameter defaults are" , e );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -10992,7 +10992,7 @@ type_param_starred_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_param_starred_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' star_expression"));
             _res = CHECK_VERSION ( expr_ty , 13 , "Type parameter defaults are" , e );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11060,7 +11060,7 @@ expressions_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11096,7 +11096,7 @@ expressions_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11235,7 +11235,7 @@ expression_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_IfExp ( b , a , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11341,7 +11341,7 @@ yield_expr_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_YieldFrom ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11377,7 +11377,7 @@ yield_expr_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Yield ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11448,7 +11448,7 @@ star_expressions_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11484,7 +11484,7 @@ star_expressions_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11571,7 +11571,7 @@ star_expression_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Starred ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11638,7 +11638,7 @@ star_named_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_named_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_named_expression+ ','?"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11702,7 +11702,7 @@ star_named_expression_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Starred ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11791,7 +11791,7 @@ assignment_expression_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( expr_ty , 8 , "Assignment expressions are" , _PyAST_NamedExpr ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -11941,7 +11941,7 @@ disjunction_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BoolOp ( Or , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12029,7 +12029,7 @@ conjunction_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BoolOp ( And , CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12117,7 +12117,7 @@ inversion_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_UnaryOp ( Not , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12201,7 +12201,7 @@ comparison_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Compare ( a , CHECK ( asdl_int_seq* , _PyPegen_get_cmpops ( p , b ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_exprs ( p , b ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12485,7 +12485,7 @@ eq_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ eq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'==' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , Eq , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12531,7 +12531,7 @@ noteq_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ noteq_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12577,7 +12577,7 @@ lte_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<=' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , LtE , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12623,7 +12623,7 @@ lt_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'<' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , Lt , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12669,7 +12669,7 @@ gte_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ gte_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>=' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , GtE , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12715,7 +12715,7 @@ gt_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ gt_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'>' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , Gt , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12764,7 +12764,7 @@ notin_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ notin_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'not' 'in' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12810,7 +12810,7 @@ in_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ in_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'in' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , In , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12859,7 +12859,7 @@ isnot_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ isnot_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' 'not' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -12905,7 +12905,7 @@ is_bitwise_or_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ is_bitwise_or[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'is' bitwise_or"));
             _res = _PyPegen_cmpop_expr_pair ( p , Is , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13008,7 +13008,7 @@ bitwise_or_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , BitOr , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13130,7 +13130,7 @@ bitwise_xor_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , BitXor , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13252,7 +13252,7 @@ bitwise_and_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , BitAnd , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13374,7 +13374,7 @@ shift_expr_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , LShift , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13413,7 +13413,7 @@ shift_expr_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , RShift , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13554,7 +13554,7 @@ sum_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , Add , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13593,7 +13593,7 @@ sum_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , Sub , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13722,7 +13722,7 @@ term_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , Mult , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13761,7 +13761,7 @@ term_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , Div , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13800,7 +13800,7 @@ term_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , FloorDiv , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13839,7 +13839,7 @@ term_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , Mod , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13878,7 +13878,7 @@ term_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( expr_ty , 5 , "The '@' operator is" , _PyAST_BinOp ( a , MatMult , b , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -13984,7 +13984,7 @@ factor_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_UnaryOp ( UAdd , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14020,7 +14020,7 @@ factor_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_UnaryOp ( USub , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14056,7 +14056,7 @@ factor_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_UnaryOp ( Invert , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14143,7 +14143,7 @@ power_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_BinOp ( a , Pow , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14230,7 +14230,7 @@ await_primary_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = CHECK_VERSION ( expr_ty , 5 , "Await expressions are" , _PyAST_Await ( a , EXTRA ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14358,7 +14358,7 @@ primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14394,7 +14394,7 @@ primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14436,7 +14436,7 @@ primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14478,7 +14478,7 @@ primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Subscript ( a , b , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14551,7 +14551,7 @@ slices_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ slices[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice !','"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14588,7 +14588,7 @@ slices_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14658,7 +14658,7 @@ slice_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Slice ( a , b , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14682,7 +14682,7 @@ slice_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14772,7 +14772,7 @@ atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_True , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14805,7 +14805,7 @@ atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_False , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14838,7 +14838,7 @@ atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_None , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -14974,7 +14974,7 @@ atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Constant ( Py_Ellipsis , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15023,7 +15023,7 @@ group_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15112,7 +15112,7 @@ lambdef_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15226,7 +15226,7 @@ lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
             _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , a , NULL , b , c , d ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15256,7 +15256,7 @@ lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
             _res = CHECK_VERSION ( arguments_ty , 8 , "Positional-only parameters are" , _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15286,7 +15286,7 @@ lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
             _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15313,7 +15313,7 @@ lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
             _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15337,7 +15337,7 @@ lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
             _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15388,7 +15388,7 @@ lambda_slash_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15417,7 +15417,7 @@ lambda_slash_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15471,7 +15471,7 @@ lambda_slash_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
             _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15503,7 +15503,7 @@ lambda_slash_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
             _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq* ) a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15578,7 +15578,7 @@ lambda_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
             _res = _PyPegen_star_etc ( p , a , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15611,7 +15611,7 @@ lambda_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
             _res = _PyPegen_star_etc ( p , NULL , b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15635,7 +15635,7 @@ lambda_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
             _res = _PyPegen_star_etc ( p , NULL , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15700,7 +15700,7 @@ lambda_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15746,7 +15746,7 @@ lambda_param_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15772,7 +15772,7 @@ lambda_param_no_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15821,7 +15821,7 @@ lambda_param_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
             _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15850,7 +15850,7 @@ lambda_param_with_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
             _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15899,7 +15899,7 @@ lambda_param_maybe_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
             _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15928,7 +15928,7 @@ lambda_param_maybe_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
             _res = _PyPegen_name_default_pair ( p , a , c , NULL );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -15989,7 +15989,7 @@ lambda_param_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16051,7 +16051,7 @@ fstring_middle_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ fstring_middle[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
             _res = _PyPegen_constant_from_token ( p , t );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16129,7 +16129,7 @@ fstring_replacement_field_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_formatted_value ( p , a , debug_expr , conversion , format , rbrace , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16194,7 +16194,7 @@ fstring_conversion_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ fstring_conversion[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"!\" NAME"));
             _res = _PyPegen_check_fstring_conversion ( p , conv_token , conv );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16258,7 +16258,7 @@ fstring_full_format_spec_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_setup_full_format_spec ( p , colon , ( asdl_expr_seq* ) spec , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16301,7 +16301,7 @@ fstring_format_spec_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ fstring_format_spec[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_MIDDLE"));
             _res = _PyPegen_decoded_constant_from_token ( p , t );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16369,7 +16369,7 @@ fstring_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ fstring[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "FSTRING_START fstring_middle* FSTRING_END"));
             _res = _PyPegen_joined_str ( p , a , ( asdl_expr_seq* ) b , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16412,7 +16412,7 @@ string_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ string[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING"));
             _res = _PyPegen_constant_from_string ( p , s );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16477,7 +16477,7 @@ strings_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_concatenate_strings ( p , a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16545,7 +16545,7 @@ list_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_List ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16612,7 +16612,7 @@ tuple_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16679,7 +16679,7 @@ set_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Set ( a , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16746,7 +16746,7 @@ dict_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Dict ( CHECK ( asdl_expr_seq* , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq* , _PyPegen_get_values ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16818,7 +16818,7 @@ double_starred_kvpairs_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ','?"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16864,7 +16864,7 @@ double_starred_kvpair_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ double_starred_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' bitwise_or"));
             _res = _PyPegen_key_value_pair ( p , NULL , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16932,7 +16932,7 @@ kvpair_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
             _res = _PyPegen_key_value_pair ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -16975,7 +16975,7 @@ for_if_clauses_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17040,7 +17040,7 @@ for_if_clause_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async' 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
             _res = CHECK_VERSION ( comprehension_ty , 6 , "Async comprehensions are" , _PyAST_comprehension ( a , b , c , 1 , p -> arena ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17083,7 +17083,7 @@ for_if_clause_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
             _res = _PyAST_comprehension ( a , b , c , 0 , p -> arena );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17120,7 +17120,7 @@ for_if_clause_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'"));
             _res = RAISE_SYNTAX_ERROR ( "'in' expected after for-loop variables" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17209,7 +17209,7 @@ listcomp_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_ListComp ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17298,7 +17298,7 @@ setcomp_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_SetComp ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17389,7 +17389,7 @@ genexp_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_GeneratorExp ( a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17478,7 +17478,7 @@ dictcomp_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17550,7 +17550,7 @@ arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ','? &')'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17636,7 +17636,7 @@ args_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_collect_call_seqs ( p , a , b , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17669,7 +17669,7 @@ args_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Call ( _PyPegen_dummy_name ( p ) , CHECK_NULL_ALLOWED ( asdl_expr_seq* , _PyPegen_seq_extract_starred_exprs ( p , a ) ) , CHECK_NULL_ALLOWED ( asdl_keyword_seq* , _PyPegen_seq_delete_starred_exprs ( p , a ) ) , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17721,7 +17721,7 @@ kwargs_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
             _res = _PyPegen_join_sequences ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17842,7 +17842,7 @@ starred_expression_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Starred ( a , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17866,7 +17866,7 @@ starred_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*'"));
             _res = RAISE_SYNTAX_ERROR ( "Invalid star expression" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17952,7 +17952,7 @@ kwarg_or_starred_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -17976,7 +17976,7 @@ kwarg_or_starred_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ kwarg_or_starred[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression"));
             _res = _PyPegen_keyword_or_starred ( p , a , 0 );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18062,7 +18062,7 @@ kwarg_or_double_starred_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18098,7 +18098,7 @@ kwarg_or_double_starred_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyPegen_keyword_or_starred ( p , CHECK ( keyword_ty , _PyAST_keyword ( NULL , a , EXTRA ) ) , 1 );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18152,7 +18152,7 @@ star_targets_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target !','"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18192,7 +18192,7 @@ star_targets_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq* , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18239,7 +18239,7 @@ star_targets_list_seq_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_targets_list_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.star_target+ ','?"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18289,7 +18289,7 @@ star_targets_tuple_seq_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ((',' star_target))+ ','?"));
             _res = ( asdl_expr_seq* ) _PyPegen_seq_insert_in_front ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18316,7 +18316,7 @@ star_targets_tuple_seq_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_targets_tuple_seq[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target ','"));
             _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18384,7 +18384,7 @@ star_target_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Starred ( CHECK ( expr_ty , _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18480,7 +18480,7 @@ target_with_star_atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18524,7 +18524,7 @@ target_with_star_atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Subscript ( a , b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18600,7 +18600,7 @@ star_atom_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
             _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18630,7 +18630,7 @@ star_atom_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ star_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' target_with_star_atom ')'"));
             _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18669,7 +18669,7 @@ star_atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( a , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18708,7 +18708,7 @@ star_atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_List ( a , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18770,7 +18770,7 @@ single_target_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
             _res = _PyPegen_set_expr_context ( p , a , Store );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18800,7 +18800,7 @@ single_target_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ single_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18871,7 +18871,7 @@ single_subscript_attribute_target_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Attribute ( a , b -> v . Name . id , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -18915,7 +18915,7 @@ single_subscript_attribute_target_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Subscript ( a , b , Store , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19025,7 +19025,7 @@ t_primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19069,7 +19069,7 @@ t_primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Subscript ( a , b , Load , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19107,7 +19107,7 @@ t_primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Call ( a , CHECK ( asdl_expr_seq* , ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19151,7 +19151,7 @@ t_primary_raw(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19177,7 +19177,7 @@ t_primary_raw(Parser *p)
         {
             D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19300,7 +19300,7 @@ del_targets_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ del_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.del_target+ ','?"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19376,7 +19376,7 @@ del_target_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Attribute ( a , b -> v . Name . id , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19420,7 +19420,7 @@ del_target_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Subscript ( a , b , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19492,7 +19492,7 @@ del_t_atom_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
             _res = _PyPegen_set_expr_context ( p , a , Del );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19522,7 +19522,7 @@ del_t_atom_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ del_t_atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' del_target ')'"));
             _res = _PyPegen_set_expr_context ( p , a , Del );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19561,7 +19561,7 @@ del_t_atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_Tuple ( a , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19600,7 +19600,7 @@ del_t_atom_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_List ( a , Del , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19668,7 +19668,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
             _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19701,7 +19701,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
             _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19734,7 +19734,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
             _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19770,7 +19770,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
             _res = ( asdl_expr_seq* ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq* , _PyPegen_singleton_seq ( p , a ) ) , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19797,7 +19797,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
             _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19824,7 +19824,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
             _res = ( asdl_expr_seq* ) _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19848,7 +19848,7 @@ type_expressions_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19899,7 +19899,7 @@ func_type_comment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
             _res = t;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -19993,7 +19993,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "iterable argument unpacking follows keyword argument unpacking" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20027,7 +20027,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20060,7 +20060,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20093,7 +20093,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(args ',')] NAME '=' &(',' | ')')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected argument value expression" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20120,7 +20120,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args for_if_clauses"));
             _res = _PyPegen_nonparen_genexp_in_call ( p , a , b );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20153,7 +20153,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' expression for_if_clauses"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , _PyPegen_get_last_comprehension_item ( PyPegen_last_item ( b , comprehension_ty ) ) , "Generator expression must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20183,7 +20183,7 @@ invalid_arguments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args ',' args"));
             _res = _PyPegen_arguments_parsing_error ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20233,7 +20233,7 @@ invalid_kwarg_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('True' | 'False' | 'None') '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to %s" , PyBytes_AS_STRING ( a -> bytes ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20266,7 +20266,7 @@ invalid_kwarg_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' expression for_if_clauses"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20295,7 +20295,7 @@ invalid_kwarg_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME '=') expression '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expression cannot contain assignment, perhaps you meant \"==\"?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20328,7 +20328,7 @@ invalid_kwarg_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwarg[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression '=' expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to keyword argument unpacking" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20410,7 +20410,7 @@ expression_without_invalid_rule(Parser *p)
             int _end_col_offset = _token->end_col_offset;
             UNUSED(_end_col_offset); // Only used by EXTRA macro
             _res = _PyAST_IfExp ( b , a , c , EXTRA );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->call_invalid_rules = _prev_call_invalid;
                 p->level--;
@@ -20500,7 +20500,7 @@ invalid_legacy_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_legacy_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME !'(' star_expressions"));
             _res = _PyPegen_check_legacy_stmt ( p , a ) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Missing parentheses in call to '%U'. Did you mean %U(...)?" , a -> v . Name . id , a -> v . Name . id ) : NULL;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20551,7 +20551,7 @@ invalid_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
             _res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : p -> tokens [p -> mark - 1] -> level == 0 ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20583,7 +20583,7 @@ invalid_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "expected 'else' after 'if' expression" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20616,7 +20616,7 @@ invalid_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' &FSTRING_MIDDLE"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "f-string: lambda expressions are not allowed without parentheses" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20672,7 +20672,7 @@ invalid_named_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':=' expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use assignment expressions with %s" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20704,7 +20704,7 @@ invalid_named_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Maybe you meant '==' or ':=' instead of '='?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20738,7 +20738,7 @@ invalid_named_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot assign to %s here. Maybe you meant '==' instead of '='?" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20794,7 +20794,7 @@ invalid_assignment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_ann_assign_target ':' expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not %s) can be annotated" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20830,7 +20830,7 @@ invalid_assignment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20860,7 +20860,7 @@ invalid_assignment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20890,7 +20890,7 @@ invalid_assignment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='"));
             _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20920,7 +20920,7 @@ invalid_assignment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -20950,7 +20950,7 @@ invalid_assignment_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign annotated_rhs"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "'%s' is an illegal expression for augmented assignment" , _PyPegen_get_expr_name ( a ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21037,7 +21037,7 @@ invalid_ann_assign_target_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_ann_assign_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' invalid_ann_assign_target ')'"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21083,7 +21083,7 @@ invalid_del_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' star_expressions"));
             _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( DEL_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21128,7 +21128,7 @@ invalid_block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21180,7 +21180,7 @@ invalid_comprehension_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "iterable unpacking cannot be used in comprehension" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21216,7 +21216,7 @@ invalid_comprehension_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , PyPegen_last_item ( b , expr_ty ) , "did you forget parentheses around the comprehension target?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21249,7 +21249,7 @@ invalid_comprehension_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "did you forget parentheses around the comprehension target?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21304,7 +21304,7 @@ invalid_dict_comprehension_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_dict_comprehension[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '**' bitwise_or for_if_clauses '}'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21356,7 +21356,7 @@ invalid_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one argument must precede /" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21386,7 +21386,7 @@ invalid_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(slash_no_default | slash_with_default) param_maybe_default* '/'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21420,7 +21420,7 @@ invalid_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default? param_no_default* invalid_parameters_helper param_no_default"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21457,7 +21457,7 @@ invalid_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* '(' param_no_default+ ','? ')'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Function parameters cannot be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21497,7 +21497,7 @@ invalid_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21527,7 +21527,7 @@ invalid_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_maybe_default+ '/' '*'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21572,7 +21572,7 @@ invalid_default_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' &(')' | ',')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected default value expression" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21622,7 +21622,7 @@ invalid_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "named arguments must follow bare *" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21652,7 +21652,7 @@ invalid_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' TYPE_COMMENT"));
             _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21682,7 +21682,7 @@ invalid_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional argument cannot have default value" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21718,7 +21718,7 @@ invalid_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* argument may appear only once" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21767,7 +21767,7 @@ invalid_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword argument cannot have default value" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21800,7 +21800,7 @@ invalid_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' param"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21833,7 +21833,7 @@ invalid_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param ',' ('*' | '**' | '/')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21876,7 +21876,7 @@ invalid_parameters_helper_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default"));
             _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21947,7 +21947,7 @@ invalid_lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"/\" ','"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "at least one argument must precede /" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -21977,7 +21977,7 @@ invalid_lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* '/'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ may appear only once" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22011,7 +22011,7 @@ invalid_lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "parameter without a default follows parameter with a default" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22048,7 +22048,7 @@ invalid_lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* '(' ','.lambda_param+ ','? ')'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "Lambda expression parameters cannot be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22088,7 +22088,7 @@ invalid_lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[(lambda_slash_no_default | lambda_slash_with_default)] lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* '/'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "/ must be ahead of *" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22118,7 +22118,7 @@ invalid_lambda_parameters_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default+ '/' '*'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expected comma between / and *" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22163,7 +22163,7 @@ invalid_lambda_parameters_helper_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default"));
             _res = _PyPegen_singleton_seq ( p , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22231,7 +22231,7 @@ invalid_lambda_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))"));
             _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22261,7 +22261,7 @@ invalid_lambda_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-positional argument cannot have default value" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22297,7 +22297,7 @@ invalid_lambda_star_etc_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (lambda_param_no_default | ',') lambda_param_maybe_default* '*' (lambda_param_no_default | ',')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "* argument may appear only once" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22349,7 +22349,7 @@ invalid_lambda_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "var-keyword argument cannot have default value" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22382,7 +22382,7 @@ invalid_lambda_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' lambda_param"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22415,7 +22415,7 @@ invalid_lambda_kwds_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param ',' ('*' | '**' | '/')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "arguments cannot follow var-keyword argument" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22470,7 +22470,7 @@ invalid_double_type_comments_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_double_type_comments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT"));
             _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22521,7 +22521,7 @@ invalid_with_item_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')"));
             _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( STAR_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22571,7 +22571,7 @@ invalid_for_target_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_for_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_expressions"));
             _res = RAISE_SYNTAX_ERROR_INVALID_TARGET ( FOR_TARGETS , a );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22620,7 +22620,7 @@ invalid_group_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' starred_expression ')'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use starred expression here" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22653,7 +22653,7 @@ invalid_group_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' '**' expression ')'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use double starred expression here" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22705,7 +22705,7 @@ invalid_import_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' ','.dotted_name+ 'from' dotted_name"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "Did you mean to use 'from ... import ...' instead?" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22732,7 +22732,7 @@ invalid_import_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_import[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import' NEWLINE"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Expected one or more names after 'import'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22781,7 +22781,7 @@ invalid_import_from_targets_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_names ',' NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22805,7 +22805,7 @@ invalid_import_from_targets_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_import_from_targets[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Expected one or more names after 'import'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22860,7 +22860,7 @@ invalid_with_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22904,7 +22904,7 @@ invalid_with_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -22964,7 +22964,7 @@ invalid_with_stmt_indent_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23013,7 +23013,7 @@ invalid_with_stmt_indent_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_with_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'with' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23068,7 +23068,7 @@ invalid_try_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'try' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23100,7 +23100,7 @@ invalid_try_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')"));
             _res = RAISE_SYNTAX_ERROR ( "expected 'except' or 'finally' block" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23149,7 +23149,7 @@ invalid_try_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_block+ 'except' '*' expression ['as' NAME] ':'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot have both 'except' and 'except*' on the same 'try'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23192,7 +23192,7 @@ invalid_try_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* except_star_block+ 'except' [expression ['as' NAME]] ':'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot have both 'except' and 'except*' on the same 'try'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23259,7 +23259,7 @@ invalid_except_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23297,7 +23297,7 @@ invalid_except_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23324,7 +23324,7 @@ invalid_except_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23354,7 +23354,7 @@ invalid_except_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')"));
             _res = RAISE_SYNTAX_ERROR ( "expected one or more exception types" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23405,7 +23405,7 @@ invalid_finally_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23465,7 +23465,7 @@ invalid_except_stmt_indent_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23497,7 +23497,7 @@ invalid_except_stmt_indent_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23559,7 +23559,7 @@ invalid_except_star_stmt_indent_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_except_star_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except*' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23610,7 +23610,7 @@ invalid_match_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr NEWLINE"));
             _res = CHECK_VERSION ( void* , 10 , "Pattern matching is" , RAISE_SYNTAX_ERROR ( "expected ':'" ) );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23645,7 +23645,7 @@ invalid_match_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_match_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"match\" subject_expr ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'match' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23700,7 +23700,7 @@ invalid_case_block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23739,7 +23739,7 @@ invalid_case_block_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_case_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "\"case\" patterns guard? ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'case' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23788,7 +23788,7 @@ invalid_as_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' \"_\""));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "cannot use '_' as a target" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23820,7 +23820,7 @@ invalid_as_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_as_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "or_pattern 'as' !NAME expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "invalid pattern target" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23869,7 +23869,7 @@ invalid_class_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_class_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "name_or_attr '(' invalid_class_argument_pattern"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( PyPegen_first_item ( a , pattern_ty ) , PyPegen_last_item ( a , pattern_ty ) , "positional patterns follow keyword patterns" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23923,7 +23923,7 @@ invalid_class_argument_pattern_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_class_argument_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "[positional_patterns ','] keyword_patterns ',' positional_patterns"));
             _res = a;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -23974,7 +23974,7 @@ invalid_if_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24009,7 +24009,7 @@ invalid_if_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_if_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' named_expression ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'if' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24060,7 +24060,7 @@ invalid_elif_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24095,7 +24095,7 @@ invalid_elif_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_elif_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'elif' named_expression ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'elif' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24146,7 +24146,7 @@ invalid_else_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'else' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24197,7 +24197,7 @@ invalid_while_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24232,7 +24232,7 @@ invalid_while_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_while_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'while' named_expression ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'while' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24293,7 +24293,7 @@ invalid_for_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24338,7 +24338,7 @@ invalid_for_stmt_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_for_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' star_targets 'in' star_expressions ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'for' statement on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24416,7 +24416,7 @@ invalid_def_raw_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'def' NAME type_params? '(' params? ')' ['->' expression] ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after function definition on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24529,7 +24529,7 @@ invalid_class_def_raw_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] NEWLINE"));
             _res = RAISE_SYNTAX_ERROR ( "expected ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24572,7 +24572,7 @@ invalid_class_def_raw_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME type_params? ['(' arguments? ')'] ':' NEWLINE !INDENT"));
             _res = RAISE_INDENTATION_ERROR ( "expected an indented block after class definition on line %d" , a -> lineno );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24652,7 +24652,7 @@ invalid_double_starred_kvpairs_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24681,7 +24681,7 @@ invalid_double_starred_kvpairs_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24729,7 +24729,7 @@ invalid_kvpair_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !(':')"));
             _res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , a -> end_lineno , - 1 , "':' expected after dictionary key" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24762,7 +24762,7 @@ invalid_kvpair_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' '*' bitwise_or"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "cannot use a starred expression in a dictionary value" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24791,7 +24791,7 @@ invalid_kvpair_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_kvpair[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "expression expected after dictionary key and ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24843,7 +24843,7 @@ invalid_starred_expression_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_starred_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression '=' expression"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "cannot assign to iterable argument unpacking" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24900,7 +24900,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '='"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '='" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24927,7 +24927,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '!'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '!'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24954,7 +24954,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' ':'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before ':'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -24981,7 +24981,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' '}'"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "f-string: valid expression required before '}'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25007,7 +25007,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' !annotated_rhs"));
             _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting a valid expression after '{'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25036,7 +25036,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs !('=' | '!' | ':' | '}')"));
             _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '=', or '!', or ':', or '}'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25068,7 +25068,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '=' !('!' | ':' | '}')"));
             _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '!', or ':', or '}'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25134,7 +25134,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !(':' | '}')"));
             _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting ':' or '}'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25177,7 +25177,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}'"));
             _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}', or format specs" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25214,7 +25214,7 @@ invalid_replacement_field_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_replacement_field[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' annotated_rhs '='? ['!' NAME] !'}'"));
             _res = PyErr_Occurred ( ) ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: expecting '}'" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25259,7 +25259,7 @@ invalid_conversion_character_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' &(':' | '}')"));
             _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: missing conversion character" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25285,7 +25285,7 @@ invalid_conversion_character_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_conversion_character[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!' !NAME"));
             _res = RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN ( "f-string: invalid conversion character" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25337,7 +25337,7 @@ invalid_arithmetic_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_arithmetic[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "sum ('+' | '-' | '*' | '/' | '%' | '//' | '@') 'not' inversion"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "'not' after an operator must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25386,7 +25386,7 @@ invalid_factor_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_factor[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('+' | '-' | '~') 'not' factor"));
             _res = RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "'not' after an operator must be parenthesized" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25432,7 +25432,7 @@ invalid_type_params_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ invalid_type_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' ']'"));
             _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( token , "Type parameter list cannot be empty" );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -25692,7 +25692,7 @@ _loop0_5_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -26105,7 +26105,7 @@ _tmp_11_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
             _res = d;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -26154,7 +26154,7 @@ _tmp_12_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
             _res = b;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -26219,7 +26219,7 @@ _tmp_13_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_13[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
             _res = d;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -26451,7 +26451,7 @@ _tmp_17_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -26505,7 +26505,7 @@ _loop0_19_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -26622,7 +26622,7 @@ _loop0_21_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -26788,7 +26788,7 @@ _tmp_23_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -26981,7 +26981,7 @@ _loop0_27_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -27090,7 +27090,7 @@ _tmp_28_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_28[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -27144,7 +27144,7 @@ _loop0_30_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -27253,7 +27253,7 @@ _tmp_31_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_31[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -27374,7 +27374,7 @@ _tmp_33_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -27420,7 +27420,7 @@ _tmp_34_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -27466,7 +27466,7 @@ _tmp_35_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -28560,7 +28560,7 @@ _loop0_52_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -28677,7 +28677,7 @@ _loop0_54_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -28794,7 +28794,7 @@ _loop0_56_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -28911,7 +28911,7 @@ _loop0_58_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -29240,7 +29240,7 @@ _tmp_62_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -29286,7 +29286,7 @@ _tmp_63_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_63[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -29412,7 +29412,7 @@ _loop0_66_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -29795,7 +29795,7 @@ _loop0_72_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -29912,7 +29912,7 @@ _loop0_74_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -30086,7 +30086,7 @@ _loop0_77_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -30203,7 +30203,7 @@ _loop0_79_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -30320,7 +30320,7 @@ _loop0_81_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -30581,7 +30581,7 @@ _loop0_85_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -30903,7 +30903,7 @@ _tmp_89_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
             _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -30957,7 +30957,7 @@ _loop0_91_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -31066,7 +31066,7 @@ _tmp_92_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_92[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
             _res = d;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -32636,7 +32636,7 @@ _tmp_115_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
             _res = _PyPegen_seq_insert_in_front ( p , y , z );
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -32690,7 +32690,7 @@ _loop0_117_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -33117,7 +33117,7 @@ _loop0_124_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -33227,7 +33227,7 @@ _tmp_125_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
             _res = k;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -33281,7 +33281,7 @@ _loop0_127_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -33398,7 +33398,7 @@ _loop0_129_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -33515,7 +33515,7 @@ _loop0_131_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -33632,7 +33632,7 @@ _loop0_133_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -33816,7 +33816,7 @@ _loop0_136_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -34045,7 +34045,7 @@ _loop0_140_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -34162,7 +34162,7 @@ _loop0_142_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -34279,7 +34279,7 @@ _loop0_144_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -34396,7 +34396,7 @@ _loop0_146_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -34513,7 +34513,7 @@ _loop0_148_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -34730,7 +34730,7 @@ _loop0_152_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -37231,7 +37231,7 @@ _loop0_191_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -38133,7 +38133,7 @@ _loop0_205_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -38250,7 +38250,7 @@ _loop0_207_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -38367,7 +38367,7 @@ _loop0_209_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -38484,7 +38484,7 @@ _loop0_211_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -38601,7 +38601,7 @@ _loop0_213_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -39570,7 +39570,7 @@ _loop0_232_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
@@ -40496,7 +40496,7 @@ _tmp_245_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_245[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -40659,7 +40659,7 @@ _tmp_248_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_248[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE"));
             _res = f;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -40705,7 +40705,7 @@ _tmp_249_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_249[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
             _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -40751,7 +40751,7 @@ _tmp_250_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_250[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
             _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -40797,7 +40797,7 @@ _tmp_251_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_251[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction"));
             _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -40843,7 +40843,7 @@ _tmp_252_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_252[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion"));
             _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -41003,7 +41003,7 @@ _tmp_255_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_255[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -41049,7 +41049,7 @@ _tmp_256_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_256[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
             _res = z;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -41221,7 +41221,7 @@ _tmp_259_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_259[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
             _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -41267,7 +41267,7 @@ _tmp_260_rule(Parser *p)
         {
             D(fprintf(stderr, "%*c+ _tmp_260[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target"));
             _res = c;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 p->level--;
                 return NULL;
@@ -41911,7 +41911,7 @@ _loop0_275_rule(Parser *p)
         )
         {
             _res = elem;
-            if (_res == NULL && PyErr_Occurred()) {
+            if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {
                 p->error_indicator = 1;
                 PyMem_Free(_children);
                 p->level--;
index 7e788e138e8e19f7f2246db684cfbf786d47e3e1..252b800dc8916d581be59d11f889f342f0dec299 100644 (file)
@@ -734,7 +734,7 @@ class CParserGenerator(ParserGenerator, GrammarVisitor):
     def emit_action(self, node: Alt, cleanup_code: str | None = None) -> None:
         self.print(f"_res = {node.action};")
 
-        self.print("if (_res == NULL && PyErr_Occurred()) {")
+        self.print("if ((_res == NULL || p->error_indicator) && PyErr_Occurred()) {")
         with self.indent():
             self.print("p->error_indicator = 1;")
             if cleanup_code: