python / python/cpython

Expand the reach of keyword typo suggestions

Open
#156,092 4 comments 1 reaction 1 assignee View on GitHub

@johnslavik is already working on this.

Since Aug 20, 2026.

interpreter-core topic-parser type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Keyword typo suggestions won't work for most realistically big source files, because

  1. we have a cap of 1024 characters of the source we recompile for probing
  2. most Python source files in practice are rather bigger

My idea is to try to shrink the source being recompiled for probing keyword typos by cutting the smallest possible window of the full source and using that window for recompilation instead. The center of the window would be in the SyntaxError reported line and offset. The window would be shortest distance line up that doesn't start with indent and any line down without a \ continuation.

As a result, keyword typo suggestions could have way further reach for realistic cases.

I might include more illustrations later. cc @pablogsal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.