[3.13] gh-128595: Default to stdout isatty for colour detection instead of stderr (GH-128498) (#129057)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Fix `test__colorize` unexpected keyword argument 'file' on buildbots (#129070)
This commit is contained in:
Hugo van Kemenade 2025-01-21 18:14:24 +02:00 committed by GitHub
parent 972d95313c
commit 383af395af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 19 additions and 10 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)