gh-128595: Default to stdout isatty for colour detection instead of stderr (#128498)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Hugo van Kemenade 2025-01-20 12:52:42 +02:00 committed by GitHub
parent a429159797
commit 6f167d7134
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 38 additions and 23 deletions

View file

@ -1558,7 +1558,7 @@ class DocTestRunner:
save_displayhook = sys.displayhook
sys.displayhook = sys.__displayhook__
saved_can_colorize = _colorize.can_colorize
_colorize.can_colorize = lambda: False
_colorize.can_colorize = lambda *args, **kwargs: False
color_variables = {"PYTHON_COLORS": None, "FORCE_COLOR": None}
for key in color_variables:
color_variables[key] = os.environ.pop(key, None)