Skip to content

gh-150459: Fix SyntaxError message for from x lazy import y#150877

Open
sobolevn wants to merge 1 commit into
python:mainfrom
sobolevn:issue-150459
Open

gh-150459: Fix SyntaxError message for from x lazy import y#150877
sobolevn wants to merge 1 commit into
python:mainfrom
sobolevn:issue-150459

Conversation

@sobolevn
Copy link
Copy Markdown
Member

@sobolevn sobolevn commented Jun 3, 2026

There's a problem with another branch of from ... import.
Because from .lazy import and from . lazy import is the same thing from the parser's point of view.

Things I've tried:

    | 'from' ('.' | '...')+ a="lazy" 'import' import_from_targets {
        RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
            "use 'lazy from ... ' instead of 'from ... lazy import'") }

What do I suggest? Maybe we can add an exception note for from .lazy import y when ImportError is raised with a similar message?

Copy link
Copy Markdown
Member

@johnslavik johnslavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️❤️❤️

Excellent

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants