diff --git a/Grammar/python.gram b/Grammar/python.gram index 574e1e14216449..641b4e9daff1e7 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -620,7 +620,7 @@ t_atom[expr_ty]: incorrect_arguments: | args ',' '*' { RAISE_SYNTAX_ERROR("iterable argument unpacking follows keyword argument unpacking") } | expression for_if_clauses ',' [args | expression for_if_clauses] { - RAISE_SYNTAX_ERROR("Generator expression must be parenthesized") } + RAISE_SYNTAX_ERROR_NO_COL_OFFSET("Generator expression must be parenthesized") } | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) } invalid_kwarg: | expression '=' { RAISE_SYNTAX_ERROR("expression cannot contain assignment, perhaps you meant \"==\"?") } diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index ae86841e8663b0..f6de5a15dd23f5 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -10550,7 +10550,7 @@ incorrect_arguments_rule(Parser *p) (opt_var = _tmp_125_rule(p), 1) // [args | expression for_if_clauses] ) { - res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" ); + res = RAISE_SYNTAX_ERROR_NO_COL_OFFSET ( "Generator expression must be parenthesized" ); if (res == NULL && PyErr_Occurred()) { p->error_indicator = 1; return NULL; diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index 06af53b3597f74..e86cf0fa337327 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -413,7 +413,7 @@ _PyPegen_raise_error(Parser *p, PyObject *errtype, int with_col_number, const ch } col_number = byte_offset_to_character_offset(loc, col_offset); } - else if (!loc) { + else { Py_INCREF(Py_None); loc = Py_None; }