From 26cfd8b4b7ebcfe53f17b2044dc2bad48b8263fb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 7 Dec 2023 17:39:41 +0200 Subject: [PATCH 1/2] Link env var and what's new to the 'Controlling color' section --- Doc/using/cmdline.rst | 5 ++++- Doc/whatsnew/3.13.rst | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 56235bf4c28c7c..9fa44c84be4174 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -612,7 +612,9 @@ Miscellaneous options .. versionadded:: 3.13 The ``-X presite`` option. -Controlling Color +.. _using-on-controlling-color: + +Controlling color ~~~~~~~~~~~~~~~~~ The Python interpreter is configured by default to use colors to highlight @@ -1135,6 +1137,7 @@ conflict. If this variable is set to ``1``, the interpreter will colorize various kinds of output. Setting it to ``0`` deactivates this behavior. + See also :ref:`using-on-controlling-color`. .. versionadded:: 3.13 diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 9adf7a3893bd70..2a4734b274c7ca 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -91,7 +91,8 @@ Improved Error Messages * The interpreter now colorizes error messages when displaying tracebacks by default. This feature can be controlled via the new :envvar:`PYTHON_COLORS` environment variable as well as the canonical ``NO_COLOR`` and ``FORCE_COLOR`` environment - variables. (Contributed by Pablo Galindo Salgado in :gh:`112730`.) + variables. See also :ref:`using-on-controlling-color`. + (Contributed by Pablo Galindo Salgado in :gh:`112730`.) Other Language Changes ====================== From 0e2aed79d33c4e1ca9ea426d8777dc0cac987154 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 7 Dec 2023 17:40:14 +0200 Subject: [PATCH 2/2] Add PYTHON_COLORS to python.man --- Misc/python.man | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Misc/python.man b/Misc/python.man index 9f89c94adf5028..14cbd85c60bfa9 100644 --- a/Misc/python.man +++ b/Misc/python.man @@ -601,6 +601,9 @@ show how long each import takes. This is exactly equivalent to setting .IP PYTHONBREAKPOINT If this environment variable is set to 0, it disables the default debugger. It can be set to the callable of your debugger of choice. +.IP PYTHON_COLORS +If this variable is set to 1, the interpreter will colorize various kinds of +output. Setting it to 0 deactivates this behavior. .SS Debug-mode variables Setting these variables only has an effect in a debug build of Python, that is, if Python was configured with the