diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2023-10-18 12:59:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 12:59:17 (GMT) |
commit | 4e4a3e161f52d17e0bab9d1757dc1610962b215b (patch) | |
tree | 586ad6f9df3b3b44fbf76a02fe52bfd17aaab156 /Grammar | |
parent | 7c308f4c64dca4093b70b7a5e49f81c4f3679359 (diff) | |
download | cpython-4e4a3e161f52d17e0bab9d1757dc1610962b215b.zip cpython-4e4a3e161f52d17e0bab9d1757dc1610962b215b.tar.gz cpython-4e4a3e161f52d17e0bab9d1757dc1610962b215b.tar.bz2 |
[3.11] gh-110696: Fix incorrect syntax error message for incorrect argument unpacking (GH-110706) (#110766)
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/python.gram | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index bae8bc3..7b462fd 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -1075,7 +1075,8 @@ func_type_comment[Token*]: # From here on, there are rules for invalid syntax with specialised error messages invalid_arguments: - | a=args ',' '*' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable argument unpacking follows keyword argument unpacking") } + | ((','.(starred_expression | ( assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' b='*' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(b, "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_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), "Generator expression must be parenthesized") } | a=NAME b='=' expression for_if_clauses { |