diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2023-05-26 12:54:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-26 12:54:37 (GMT) |
commit | ba73473f4c18ba4cf7ab18d84d94a47d2d37a0c5 (patch) | |
tree | 64dd261a14ec8991182807c5a01f8042c5fb6f1f /Grammar | |
parent | 6e1eccdcce5ea3bf1ef9d326d20ef9df21262c6b (diff) | |
download | cpython-ba73473f4c18ba4cf7ab18d84d94a47d2d37a0c5.zip cpython-ba73473f4c18ba4cf7ab18d84d94a47d2d37a0c5.tar.gz cpython-ba73473f4c18ba4cf7ab18d84d94a47d2d37a0c5.tar.bz2 |
gh-104799: Move location of type_params AST fields (#104828)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/python.gram | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index e6a9834..9131835 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -254,10 +254,10 @@ class_def[stmt_ty]: class_def_raw[stmt_ty]: | invalid_class_def_raw | 'class' a=NAME t=[type_params] b=['(' z=[arguments] ')' { z }] ':' c=block { - _PyAST_ClassDef(a->v.Name.id, t, + _PyAST_ClassDef(a->v.Name.id, (b) ? ((expr_ty) b)->v.Call.args : NULL, (b) ? ((expr_ty) b)->v.Call.keywords : NULL, - c, NULL, EXTRA) } + c, NULL, t, EXTRA) } # Function definitions # -------------------- @@ -269,17 +269,17 @@ function_def[stmt_ty]: function_def_raw[stmt_ty]: | invalid_def_raw | 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block { - _PyAST_FunctionDef(n->v.Name.id, t, + _PyAST_FunctionDef(n->v.Name.id, (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)), - b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) } + b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) } | ASYNC 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block { CHECK_VERSION( stmt_ty, 5, "Async functions are", - _PyAST_AsyncFunctionDef(n->v.Name.id, t, + _PyAST_AsyncFunctionDef(n->v.Name.id, (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)), - b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) + b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) ) } # Function parameters |