https://github.com/python/cpython/commit/ff64d8de66ab7f8e56b5d410796a7d76c955280c
commit: ff64d8de66ab7f8e56b5d410796a7d76c955280c
branch: main
author: Bartosz Sławecki <[email protected]>
committer: Eclips4 <[email protected]>
date: 2026-06-10T09:36:50+03:00
summary:
gh-145239: Colorize `case +` in the REPL (#150979)
files:
M Lib/_pyrepl/utils.py
M Lib/test/test_pyrepl/test_utils.py
diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py
index b50426c31ead53a..f2837a1b8eb95e7 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 3c55b6bdaeee9e8..0b873d32b62b5d2 100644
--- a/Lib/test/test_pyrepl/test_utils.py
+++ b/Lib/test/test_pyrepl/test_utils.py
@@ -125,6 +125,14 @@ def test_gen_colors_keyword_highlighting(self):
("import", "keyword"),
],
),
+ (
+ "case +1",
+ [
+ ("case", "soft_keyword"),
+ ("+", "op"),
+ ("1", "number"),
+ ],
+ ),
]
for code, expected_highlights in cases:
with self.subTest(code=code):
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]