summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorMatthieu Dartiailh <marul@laposte.net>2022-04-05 16:21:49 (GMT)
committerGitHub <noreply@github.com>2022-04-05 16:21:49 (GMT)
commit94609e3192f15636c760a48c4c1c2c236fac3217 (patch)
treece29210ce50fd9873fbafc9497b09991f97207b3 /Grammar
parent857cf55cbdd65b7a9534dc35d89a19dfe8cbdba5 (diff)
downloadcpython-94609e3192f15636c760a48c4c1c2c236fac3217.zip
cpython-94609e3192f15636c760a48c4c1c2c236fac3217.tar.gz
cpython-94609e3192f15636c760a48c4c1c2c236fac3217.tar.bz2
[3.10] Backport bpo-47212 (GH-32302) to Python 3.10 (GH-32334)
(cherry picked from commit aa0f056a00c4bcaef83d729e042359ddae903382) # Conflicts: # Grammar/python.gram # Parser/action_helpers.c Automerge-Triggered-By: GH:pablogsal
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/python.gram6
1 files changed, 3 insertions, 3 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 99e0135..84b9c9b 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -830,12 +830,12 @@ t_lookahead: '(' | '[' | '.'
invalid_arguments:
| a=args ',' '*' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable argument unpacking follows keyword argument unpacking") }
| a=expression b=for_if_clauses ',' [args | expression for_if_clauses] {
- RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, comprehension_ty)->target, "Generator expression must be parenthesized") }
+ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, _PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), "Generator expression must be parenthesized") }
| a=NAME b='=' expression for_if_clauses {
RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")}
| a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }
| args ',' a=expression b=for_if_clauses {
- RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, asdl_seq_GET(b, b->size-1)->target, "Generator expression must be parenthesized") }
+ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, _PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), "Generator expression must be parenthesized") }
| a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }
invalid_kwarg:
| a[Token*]=('True'|'False'|'None') b='=' {
@@ -975,7 +975,7 @@ invalid_finally_stmt:
invalid_except_stmt_indent:
| a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {
RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) }
- | a='except' ':' NEWLINE !INDENT { RAISE_SYNTAX_ERROR("expected an indented block after except statement on line %d", a->lineno) }
+ | a='except' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) }
invalid_match_stmt:
| "match" subject_expr !':' { CHECK_VERSION(void*, 10, "Pattern matching is", RAISE_SYNTAX_ERROR("expected ':'") ) }
| a="match" subject=subject_expr ':' NEWLINE !INDENT {