Skip to content

gh-151471: IDLE colorizes type as a soft keyword - #155958

Open
imabd645 wants to merge 1 commit into
python:mainfrom
imabd645:fix-idle-type-keyword-151471
Open

gh-151471: IDLE colorizes type as a soft keyword#155958
imabd645 wants to merge 1 commit into
python:mainfrom
imabd645:fix-idle-type-keyword-151471

Conversation

@imabd645

@imabd645 imabd645 commented Aug 17, 2026

Copy link
Copy Markdown

Description

This PR fixes a syntax highlighting issue in IDLE where the type keyword (introduced in Python 3.12 for type parameter syntax) was incorrectly highlighted as a built-in variable instead of a soft keyword.

Changes:

  • Added type_softkw to the regular expression patterns in Lib/idlelib/colorizer.py.
  • Configured the colorizer to map TYPE_SOFTKW to KEYWORD.
  • Ensured it only highlights as a keyword when it appears at the beginning of a statement and is followed by whitespace and a valid identifier.
  • Added the corresponding NEWS blurb.

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.

1 participant