python / python/cpython

Tachyon's `pstats_collector` does not respect "no-color" modes

オープン
#154,335 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib topic-profiling type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

The Tachyon sampling profiler always emits colored output when used with the pstats collector. For example, the NO_COLOR environment variable is currently not respected:

NO_COLOR=1 python -m profiling.sampling run --pstats test.py

Enabling this would be useful e.g. in cases where the output is redirected into a file for further processing, as it avoids including ANSI escape sequences in the file.

There is already a helper function available in the project that could be used to enable this functionality:
https://github.com/python/cpython/blob/main/Lib/_colorize.py#L564-L605

If you think this would be a useful addition/fix, I'd be happy to work on a patch PR.

Best, Peter

CPython versions tested on:

3.15

Operating systems tested on:

No response

Linked PRs
  • gh-154344

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

エントリポイント python -m profiling.sampling run --pstats test.py から始め、Lib/_colorize.py にある色処理ヘルパーを調べてください。pstats コレクターが NO_COLOR=1 を尊重することと、リダイレクトされた出力に ANSI エスケープシーケンスが含まれないことを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。