Improve `SyntaxError` message for `import a as b.c` · Issue #123539 · python/cpython · GitHub
Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions