]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-134953: Expand theming for `True`/`False`/`None` (GH-135000) (#138928)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 15 Sep 2025 16:02:40 +0000 (18:02 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Sep 2025 16:02:40 +0000 (19:02 +0300)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Lib/_colorize.py
Lib/_pyrepl/utils.py
Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst [new file with mode: 0644]

index 4a310a402358b6cd68427c9841fea0fe19a07cd9..7c09bb4564c2e01fb29d697c2429d019ab1dad33 100644 (file)
@@ -176,6 +176,7 @@ class Argparse(ThemeSection):
 class Syntax(ThemeSection):
     prompt: str = ANSIColors.BOLD_MAGENTA
     keyword: str = ANSIColors.BOLD_BLUE
+    keyword_constant: str = ANSIColors.BOLD_BLUE
     builtin: str = ANSIColors.CYAN
     comment: str = ANSIColors.RED
     string: str = ANSIColors.GREEN
index c5d006afa7731fa87118825a2f389b114a742777..d32fce591fadcc2d3be568f0f5836120442ec031 100644 (file)
@@ -196,6 +196,9 @@ def gen_colors_from_token_stream(
                     is_def_name = False
                     span = Span.from_token(token, line_lengths)
                     yield ColorSpan(span, "definition")
+                elif token.string in ("True", "False", "None"):
+                    span = Span.from_token(token, line_lengths)
+                    yield ColorSpan(span, "keyword_constant")
                 elif keyword.iskeyword(token.string):
                     span = Span.from_token(token, line_lengths)
                     yield ColorSpan(span, "keyword")
diff --git a/Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst b/Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst
new file mode 100644 (file)
index 0000000..c2f112d
--- /dev/null
@@ -0,0 +1,2 @@
+Expand ``_colorize`` theme with ``keyword_constant`` and implement in
+:term:`repl`.