[3.14] gh-138239: Fix incorrect highlighting of "type" in type statements in the REPL (GH-138241) (GH-138937)

(cherry picked from commit 26cfb17942)

Co-authored-by: 00ll00 <40747228+00ll00@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2025-10-07 23:02:32 +02:00 committed by GitHub
parent e953cead61
commit 61d49a5d37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View file

@ -264,6 +264,12 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool:
return True
case (TI(string="case"), TI(string="_"), TI(string=":")):
return True
case (
None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT) | TI(string=":"),
TI(string="type"),
TI(T.NAME, string=s)
):
return not keyword.iskeyword(s)
case _:
return False