diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2023-10-17 12:45:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-17 12:45:13 (GMT) |
commit | 24e4ec7766fd471deb5b7e5087f0e7dba8576cfb (patch) | |
tree | 76530df6f2e24de8c9c016476cbe0026bae90505 /Grammar | |
parent | be5e8a010341c4d2d28ef53a1baed402ee06466e (diff) | |
download | cpython-24e4ec7766fd471deb5b7e5087f0e7dba8576cfb.zip cpython-24e4ec7766fd471deb5b7e5087f0e7dba8576cfb.tar.gz cpython-24e4ec7766fd471deb5b7e5087f0e7dba8576cfb.tar.bz2 |
gh-110938: Fix error messages for indented blocks with functions and classes with generic type parameters (#110973)
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/python.gram | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index 8b479a7..ec964d6 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -1369,11 +1369,11 @@ invalid_for_stmt: | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'for' statement on line %d", a->lineno) } invalid_def_raw: - | ['async'] a='def' NAME '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT { + | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after function definition on line %d", a->lineno) } invalid_class_def_raw: - | 'class' NAME ['(' [arguments] ')'] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } - | a='class' NAME ['(' [arguments] ')'] ':' NEWLINE !INDENT { + | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } + | a='class' NAME [type_params] ['(' [arguments] ')'] ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after class definition on line %d", a->lineno) } invalid_double_starred_kvpairs: |