Skip to content

The traceback module does not colorize by default, contrary to its documentation #159661

Closed

Description

@atrigent

Documentation

The documentation for the traceback module states:

Added in version 3.13: Output is colorized by default and can be controlled using environment variables.

This is incorrect. When the APIs documented in the traceback module documentation page are used as documented, the output is never colorized.

Bizarrely, this note was added in #127223, which had nothing to do with changing the behavior of the traceback module, and did not make any changes to it.

@pablogsal, in #142896 you stated that this functionality is intentionally not yet exposed to users of the traceback module. It has now been almost 3 years since this functionality landed for exceptions that reach the interpreter. Please explain why the module functionality is still private and what you intend to do to fix this.

Thanks.

Linked PRs

Activity

  1. pablogsal commented on Oct 18, 2026

    @pablogsal
    Member

    Please explain why the module functionality is still private and what you intend to do to fix this.

    Because I don't think color should be part of the public API of the traceback module. The interpreter uses it so it needs to deal with it but that doesn't mean we want to make it leak to the public API.

    I don't intend to do anything to "fix" it because there isn't anything to fix. We can reconsider the decision (I don't think we should) but this is not a bug

  2. atrigent commented on Oct 18, 2026

    @atrigent
    Author

    Because I don't think color should be part of the public API of the traceback module.

    Ok... Why?

  3. pablogsal commented on Oct 18, 2026

    @pablogsal
    Member

    Because I don't think color should be part of the public API of the traceback module.

    Ok... Why?

    Because is not the trackback module concern and will be more difficult for us to maintain and change.

  4. atrigent commented on Oct 18, 2026

    @atrigent
    Author

    Because is not the trackback module concern and will be more difficult for us to maintain and change.

    Right. As I suspected, you don't have an actual reason. The few words you said here could be applied to anything.

  5. pablogsal commented on Oct 18, 2026

    @pablogsal
    Member

    Right. As I suspected, you don't have an actual reason. The few words you said here could be applied to anything.

    I am not going to engage more with this argument.

    Please keep this discussion respectful. Dismissing another contributor in this way is inappropriate. The PSF Code of Conduct asks us to respect others and their efforts, and to remain courteous when we disagree. You are welcome to challenge a technical decision, but please address the technical points without personal remarks.

    The documentation mismatch you reported is valid, and I will correct it. Thank you for flagging it.

  6. removed
    pendingThe issue will be closed if no feedback is provided
    on Oct 18, 2026
  7. added a commit that references this issue on Oct 18, 2026
  8. atrigent commented on Oct 18, 2026

    @atrigent
    Author

    Not a single thing you have said here even remotely resembles a "technical point", my dude.

  9. added 2 commits that reference this issue on Oct 18, 2026
  10. locked as too heated and limited conversation to collaborators on Oct 18, 2026
  11. hugovk commented on Oct 18, 2026

    @hugovk
    Member

    The cost of maintenance and backwards compatibility is a very important point. Locking this as you've already been asked to keep things civil and this isn't going anywhere.

  12. pablogsal commented on Oct 18, 2026

    @pablogsal
    Member

    Corrected the documentation in #159668, with backports merged for Python 3.15 in #159670 and Python 3.14 in #159671. The Python 3.13 documentation does not contain the incorrect note.

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

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions