File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1432,10 +1432,14 @@ invalid_import:
14321432 | 'import' token=NEWLINE {
14331433 RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
14341434invalid_dotted_as_name:
1435+ | a=dotted_name b=['as' NAME] c=dotted_name {
1436+ RAISE_SYNTAX_ERROR_KNOWN_RANGE(b ? (expr_ty) b : a, c, "expected comma between import clauses") }
14351437 | dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {
14361438 RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
14371439 "cannot use %s as import target", _PyPegen_get_expr_name(a)) }
14381440invalid_import_from_as_name:
1441+ | [NAME 'as'] a=NAME b=NAME {
1442+ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "expected comma between import clauses") }
14391443 | NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {
14401444 RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
14411445 "cannot use %s as import target", _PyPegen_get_expr_name(a)) }
Original file line number Diff line number Diff line change 22252225Traceback (most recent call last):
22262226SyntaxError: Expected one or more names after 'import'
22272227
2228+ >>> import a b
2229+ Traceback (most recent call last):
2230+ SyntaxError: expected comma between import clauses
2231+
2232+ >>> import a.a as a b.b
2233+ Traceback (most recent call last):
2234+ SyntaxError: expected comma between import clauses
2235+
2236+ >>> from x import a b
2237+ Traceback (most recent call last):
2238+ SyntaxError: expected comma between import clauses
2239+
2240+ >>> from x import a as a b
2241+ Traceback (most recent call last):
2242+ SyntaxError: expected comma between import clauses
2243+
22282244>>> (): int
22292245Traceback (most recent call last):
22302246SyntaxError: only single target (not tuple) can be annotated
You can’t perform that action at this time.
0 commit comments