Skip to content

Improve SyntaxError message for import a as b.c #123539

@sobolevn

Description

@sobolevn

Feature or enhancement

Right now it shows:

>>> import a as b.c
  File "<unknown>", line 1
    import a as b.c
                 ^
SyntaxError: invalid syntax

Proposed message:

>>> import a as b.c
  File "<unknown>", line 1
    import a as b.c
                ^^^
SyntaxError: cannot use import statement with attribute

Refs #123440

I have a PR ready.

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions