Skip to content

Improve from x import error message #118082

Closed
@sobolevn

Description

@sobolevn

Feature or enhancement

While reading new ruff release notes: https://astral.sh/blog/ruff-v0.4.0 I found that it has a new nice parser feature that we can addopt. Before:

>>> from x import
  File "<stdin>", line 1
    from x import
                 ^
SyntaxError: invalid syntax
>>> from . import
  File "<stdin>", line 1
    from . import
                 ^
SyntaxError: invalid syntax
>>> from x import
  File "<stdin>", line 1
    from x import
                 ^
SyntaxError: Expected one or more names after 'import'
>>> from . import
  File "<stdin>", line 1
    from . import
                 ^
SyntaxError: Expected one or more names after 'import'
>>> 

I have a PR ready :)

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions