Skip to content

Move keyword typo suggestions into the parser #159672

Description

@pablogsal

The current keyword typo suggestions work, but the approach is a bit hacky and has some problems.

traceback copies source text and compiles each possible keyword replacement. It needs full-source metadata or access to the source file. Hints can disappear in larger files or differ between file and string input. Repeated calls can also change the formatted output.

Move this work into the parser and use its cached tokens, keyword tables, and grammar. Attach the hint to SyntaxError for traceback to display.

Related: #156047, #156092, #154544.

Linked PRs

Activity

  1. added 20 commits that reference this issue on Oct 18, 2026
  2. added a commit that references this issue on Oct 18, 2026
  3. moved this from Todo to In progress in Project_VKon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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