bpo-41064: Improve syntax error for invalid usage of '**' in f-strings (GH-25006)

This commit is contained in:
Pablo Galindo 2021-03-24 19:34:17 +00:00 committed by GitHub
parent 4958f5d69d
commit 8efad61963
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 1 deletions

View file

@ -842,6 +842,8 @@ invalid_for_target:
invalid_group:
| '(' a=starred_expression ')' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "can't use starred expression here") }
| '(' a='**' expression ')' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "can't use double starred expression here") }
invalid_import_from_targets:
| import_from_as_names ',' {
RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }