Skip to content

Suggest a future feature name in from __future__ import #145868

Open

Description

@Locked-chess-official

Feature or enhancement

Proposal:

When from __future__ import with a wrong name, maybe it is a typo. We can suggest a possible name. Just like:

>>> from __future__ import annotation
  File "<python-input-0>", line 1
    from __future__ import annotation
                           ^^^^^^^^^^
SyntaxError: future feature 'annotation' is not defined. Did you mean: 'annotations'?

One possible way is just read the line and analyse.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 12, 2026
  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 12, 2026
  3. picnixz commented on Mar 12, 2026

    @picnixz
    Member

    The error is raised at the interpreter's level. However we need to use _Py_CalculateSuggestions in this case. Currently, the only future that is not a nop is annotations so I wonder whether it will really be useful (and we also want to move away from it and only new versions will see the improved message).

  4. self-assigned this
    on Jul 21, 2026
  5. added 2 commits that reference this issue on Jul 21, 2026
  6. added 2 commits that reference this issue on Sep 24, 2026
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