Skip to content

Empty values of FORCE_COLOR and NO_COLOR are not ignored #129061

Description

@serhiy-storchaka

Bug report

Bug description:

https://no-color.org/

Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color.

https://force-color.org/

Command-line software which outputs colored text should check for a FORCE_COLOR environment variable. When this variable is present and not an empty string (regardless of its value), it should force the addition of ANSI color.

Both "standards" state that these environment variables has only effect if their value is not an empty string. But Python currently only tests that the environment variables are defined.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    3.13only security fixes
    3.14bugs and security fixes
    topic-replRelated to the interactive shell
    type-bugAn unexpected behavior, bug, or error
    on Jan 20, 2025
  2. serhiy-storchaka commented on Jan 20, 2025

    @serhiy-storchaka
    MemberAuthor
  3. erlend-aasland commented on Jan 20, 2025

    @erlend-aasland
    Contributor

    See also earlier discussion: #128318 (comment)

  4. hugovk commented on Jan 23, 2025

    @hugovk
    Member

    Please see PR #129140.

  5. added a commit that references this issue on Jan 27, 2025
  6. added a commit that references this issue on Jan 27, 2025
  7. added a commit that references this issue on Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixes3.14bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions