Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to stdout isatty for colour detection instead of stderr #128595

Closed
hugovk opened this issue Jan 7, 2025 · 0 comments
Closed

Default to stdout isatty for colour detection instead of stderr #128595

hugovk opened this issue Jan 7, 2025 · 0 comments
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@hugovk
Copy link
Member

hugovk commented Jan 7, 2025

Bug report

Bug description:

The terminal colour detection defaults to checking stderr's isatty, rather than stdout.

As suggested at #128317 (comment), let's default to checking stdout's isatty rather than stderr's.

Here some example output, plus when piping it:

NowProposal
image image
image image
image image
image image

CPython versions tested on:

3.13, CPython main branch

Operating systems tested on:

macOS

Linked PRs

@hugovk hugovk added the type-bug An unexpected behavior, bug, or error label Jan 7, 2025
@hugovk hugovk added 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Jan 7, 2025
@picnixz picnixz added the stdlib Python modules in the Lib dir label Jan 10, 2025
hugovk added a commit that referenced this issue Jan 13, 2025
hugovk added a commit to hugovk/cpython that referenced this issue Jan 13, 2025
…lour (pythonGH-128687)

(cherry picked from commit afb9dc8)

Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
hugovk added a commit that referenced this issue Jan 20, 2025
…tderr (#128498)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
hugovk added a commit to hugovk/cpython that referenced this issue Jan 20, 2025
… instead of stderr (pythonGH-128498)

(cherry picked from commit 6f167d7)

Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
hugovk added a commit to hugovk/cpython that referenced this issue Jan 20, 2025
… instead of stderr (pythonGH-128498)

(cherry picked from commit 6f167d7)

Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
…d of stderr (python#128498)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
hugovk added a commit to hugovk/cpython that referenced this issue Jan 21, 2025
hugovk added a commit that referenced this issue Jan 21, 2025
…ad of stderr (GH-128498) (#129057)

Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Fix `test__colorize` unexpected keyword argument 'file' on buildbots (#129070)
@hugovk hugovk closed this as completed Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants