From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 15 Sep 2025 16:02:40 +0000 (+0200) Subject: [3.14] gh-134953: Expand theming for `True`/`False`/`None` (GH-135000) (#138928) X-Git-Tag: v3.14.0rc3~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc4d016e7eaabead9e0ba9d259a5d1eba1932b3e;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-134953: Expand theming for `True`/`False`/`None` (GH-135000) (#138928) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Ɓukasz Langa --- diff --git a/Lib/_colorize.py b/Lib/_colorize.py index 4a310a402358..7c09bb4564c2 100644 --- a/Lib/_colorize.py +++ b/Lib/_colorize.py @@ -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 diff --git a/Lib/_pyrepl/utils.py b/Lib/_pyrepl/utils.py index c5d006afa773..d32fce591fad 100644 --- a/Lib/_pyrepl/utils.py +++ b/Lib/_pyrepl/utils.py @@ -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 index 000000000000..c2f112dc62ce --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst @@ -0,0 +1,2 @@ +Expand ``_colorize`` theme with ``keyword_constant`` and implement in +:term:`repl`.