summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-10-18 05:26:34 (GMT)
committerGitHub <noreply@github.com>2023-10-18 05:26:34 (GMT)
commit2bca5f43af8fc1c7643fb7769d04a25fbd5f0d98 (patch)
tree930ede65a8998242c5b5f6ed477b1084a7bd9190 /Grammar
parent8134811089f1907ea56085c6a7de9ce0afbc56c8 (diff)
downloadcpython-2bca5f43af8fc1c7643fb7769d04a25fbd5f0d98.zip
cpython-2bca5f43af8fc1c7643fb7769d04a25fbd5f0d98.tar.gz
cpython-2bca5f43af8fc1c7643fb7769d04a25fbd5f0d98.tar.bz2
[3.12] gh-110938: Fix error messages for indented blocks with functio… (#110990)
[3.12] gh-110938: Fix error messages for indented blocks with functions and classes with generic type parameters (GH-110973) (cherry picked from commit 24e4ec7766fd471deb5b7e5087f0e7dba8576cfb) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
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 c442db2..a4fd3f2 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: