gh-98931: Add custom error messages to invalid import/from with multiple targets (#105985)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Pablo Galindo Salgado 2023-06-22 16:56:40 +01:00 committed by GitHub
parent a8006706f7
commit 13237a2da8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1347 additions and 1206 deletions

View file

@ -1293,7 +1293,7 @@ invalid_group:
| '(' a='**' expression ')' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use double starred expression here") }
invalid_import:
| a='import' dotted_name 'from' dotted_name {
| a='import' ','.dotted_name+ 'from' dotted_name {
RAISE_SYNTAX_ERROR_STARTING_FROM(a, "Did you mean to use 'from ... import ...' instead?") }
invalid_import_from_targets: