From 510c20081df5f28a11e374fae6607d8dbbbf559c Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 6 Dec 2025 18:13:57 +0000 Subject: [PATCH] Fix repl not coloring 'lazy' after 'from' --- Lib/_pyrepl/utils.py | 2 +- Lib/test/test_pyrepl/test_utils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py index e694720199f..98b178f1dd2 100644 --- a/Lib/_pyrepl/utils.py +++ b/Lib/_pyrepl/utils.py @@ -276,7 +276,7 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool: TI(T.NAME, string=s) ): return not keyword.iskeyword(s) - case (None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT), TI(string="lazy"), TI(string="import")): + case (None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT), TI(string="lazy"), TI(string="import") | TI(string="from")): return True case _: return False diff --git a/Lib/test/test_pyrepl/test_utils.py b/Lib/test/test_pyrepl/test_utils.py index 411ce6fc169..7b22353708c 100644 --- a/Lib/test/test_pyrepl/test_utils.py +++ b/Lib/test/test_pyrepl/test_utils.py @@ -96,6 +96,7 @@ def test_gen_colors_keyword_highlighting(self): ("list", [("list", "builtin")]), (" \n dict", [("dict", "builtin")]), (" lazy import", [("lazy", "soft_keyword"), ("import", "keyword")]), + ("lazy from cool_people import pablo", [('lazy', 'soft_keyword'), ('from', 'keyword'), ('import', 'keyword')]) ] for code, expected_highlights in cases: with self.subTest(code=code):