diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2023-10-12 10:51:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-12 10:51:56 (GMT) |
commit | 4d0e6c895e8b7396ea9d84422db05b329d1985ac (patch) | |
tree | 531c3bfb36e8e36a878159fba476a4055dad7f6e /Grammar | |
parent | ea3ac56a05d00da82ffd4b9326654aab4893cb72 (diff) | |
download | cpython-4d0e6c895e8b7396ea9d84422db05b329d1985ac.zip cpython-4d0e6c895e8b7396ea9d84422db05b329d1985ac.tar.gz cpython-4d0e6c895e8b7396ea9d84422db05b329d1985ac.tar.bz2 |
[3.12] gh-110696: Fix incorrect syntax error message for incorrect argument unpacking (GH-110706) (#110765)
(cherry picked from commit 3d180347ae73119bb51500efeeafdcd62bcc6f78)
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 ed0b326..c442db2 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -1128,7 +1128,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 { |