[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

@ -135,7 +135,7 @@ BUILTIN_EXCEPTION_LIMIT = object()
def _print_exception_bltin(exc, /):
file = sys.stderr if sys.stderr is not None else sys.__stderr__
colorize = _colorize.can_colorize()
colorize = _colorize.can_colorize(file=file)
return print_exception(exc, limit=BUILTIN_EXCEPTION_LIMIT, file=file, colorize=colorize)