Skip to content

[3.13] gh-151471: Colorize the soft keyword type in IDLE (GH-151700) - #157993

Merged
serhiy-storchaka merged 1 commit into
python:3.13from
serhiy-storchaka:bp-151471-3.13
Sep 23, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.13from
serhiy-storchaka:bp-151471-3.13

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

type is now colored as a keyword when it starts a statement and is followed by a name, as in type Point = tuple[float, float]. It stays a builtin elsewhere, for example in type = type(1), type(x) or type in (int, str).

(cherry picked from commit 68ed7a5)

Manual backport: test_recolorize_main asserts tags at absolute line numbers, and the colorizer colorizes in chunks whose size doubles, so which chunk a line falls into depends on how many lines precede it. This branch has one line fewer in the test source, and the new type line ends up in a chunk which starts inside the unterminated string above it. Instead of the two lines there, this adds test_type_soft_keyword, which checks the tag ranges of separate snippets.

Co-authored-by: Shixian Li znsoooo@gmail.com

…51700)

`type` is now colored as a keyword when it starts a statement and is
followed by a name, as in `type Point = tuple[float, float]`.  It stays
a builtin elsewhere, for example in `type = type(1)`, `type(x)` or
`type in (int, str)`.

(cherry picked from commit 68ed7a5)
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) September 23, 2026 11:19
@serhiy-storchaka
serhiy-storchaka merged commit f941512 into python:3.13 Sep 23, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants