From: Bartosz Sławecki Date: Wed, 10 Jun 2026 06:36:50 +0000 (+0200) Subject: gh-145239: Colorize `case +` in the REPL (#150979) X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ff64d8de66ab7f8e56b5d410796a7d76c955280c;p=thirdparty%2FPython%2Fcpython.git gh-145239: Colorize `case +` in the REPL (#150979) --- diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py index b50426c31ead..f2837a1b8eb9 100644 --- a/Lib/_pyrepl/utils.py +++ b/Lib/_pyrepl/utils.py @@ -274,7 +274,7 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool: None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT) | TI(string=":"), TI(string="case"), TI(T.NUMBER | T.STRING | T.FSTRING_START | T.TSTRING_START) - | TI(T.OP, string="(" | "*" | "-" | "[" | "{") + | TI(T.OP, string="(" | "*" | "-" | "+" | "[" | "{") ): return True case ( diff --git a/Lib/test/test_pyrepl/test_utils.py b/Lib/test/test_pyrepl/test_utils.py index 3c55b6bdaeee..0b873d32b62b 100644 --- a/Lib/test/test_pyrepl/test_utils.py +++ b/Lib/test/test_pyrepl/test_utils.py @@ -125,6 +125,14 @@ class TestUtils(TestCase): ("import", "keyword"), ], ), + ( + "case +1", + [ + ("case", "soft_keyword"), + ("+", "op"), + ("1", "number"), + ], + ), ] for code, expected_highlights in cases: with self.subTest(code=code):