From 4e767b5406651da45fea95e09b75d5f4dca4a4e7 Mon Sep 17 00:00:00 2001 From: pfackeldey Date: Tue, 21 Jul 2026 12:20:45 +0200 Subject: [PATCH 1/2] Use _colorize.get_colors() to allow disabling ANSI escape codes through environment variables --- Lib/profiling/sampling/pstats_collector.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/profiling/sampling/pstats_collector.py b/Lib/profiling/sampling/pstats_collector.py index 7132cffd58f094a..c1da859202895d7 100644 --- a/Lib/profiling/sampling/pstats_collector.py +++ b/Lib/profiling/sampling/pstats_collector.py @@ -1,11 +1,12 @@ import collections import marshal import pstats -lazy from _colorize import ANSIColors +from _colorize import get_colors from .collector import Collector, extract_lineno from .constants import MICROSECONDS_PER_SECOND, PROFILING_MODE_CPU +ANSIColors = get_colors() class PstatsCollector(Collector): aggregating = True From d5d629f1dcecc465be3ec1d7fe420d248bfd6806 Mon Sep 17 00:00:00 2001 From: pfackeldey Date: Tue, 21 Jul 2026 12:24:55 +0200 Subject: [PATCH 2/2] add news entry --- .../next/Library/2026-07-21-12-23-48.gh-issue-154335.SRf8Gr.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-07-21-12-23-48.gh-issue-154335.SRf8Gr.rst diff --git a/Misc/NEWS.d/next/Library/2026-07-21-12-23-48.gh-issue-154335.SRf8Gr.rst b/Misc/NEWS.d/next/Library/2026-07-21-12-23-48.gh-issue-154335.SRf8Gr.rst new file mode 100644 index 000000000000000..c3241b0c42c7e30 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-07-21-12-23-48.gh-issue-154335.SRf8Gr.rst @@ -0,0 +1 @@ +Allow disabling terminal coloring for Tachyon's pstats collector.