https://github.com/python/cpython/commit/2e2109d2248d9b59d1085d428831457c12cd32c0
commit: 2e2109d2248d9b59d1085d428831457c12cd32c0
branch: main
author: Hugo van Kemenade <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-02-28T01:48:35Z
summary:

gh-142927: Tachyon: Fix singular and plurals (#145329)

files:
M Lib/profiling/sampling/sample.py
M Lib/profiling/sampling/stack_collector.py

diff --git a/Lib/profiling/sampling/sample.py b/Lib/profiling/sampling/sample.py
index c6abfb1c8ee885..6a76bbeeb24ee3 100644
--- a/Lib/profiling/sampling/sample.py
+++ b/Lib/profiling/sampling/sample.py
@@ -164,7 +164,8 @@ def sample(self, collector, duration_sec=None, *, 
async_aware=False):
         # Don't print stats for live mode (curses is handling display)
         is_live_mode = LiveStatsCollector is not None and 
isinstance(collector, LiveStatsCollector)
         if not is_live_mode:
-            print(f"Captured {num_samples:n} samples in {fmt(running_time_sec, 
2)} seconds")
+            s = "" if num_samples == 1 else "s"
+            print(f"Captured {num_samples:n} sample{s} in 
{fmt(running_time_sec, 2)} seconds")
             print(f"Sample rate: {fmt(sample_rate, 2)} samples/sec")
             print(f"Error rate: {fmt(error_rate, 2)}")
 
diff --git a/Lib/profiling/sampling/stack_collector.py 
b/Lib/profiling/sampling/stack_collector.py
index 4e213cfe41ca24..5a3497a5408414 100644
--- a/Lib/profiling/sampling/stack_collector.py
+++ b/Lib/profiling/sampling/stack_collector.py
@@ -144,9 +144,13 @@ def export(self, filename):
         num_functions = len(flamegraph_data.get("children", []))
         total_time = flamegraph_data.get("value", 0)
         string_count = len(self._string_table)
+        s1 = "" if num_functions == 1 else "s"
+        s2 = "" if total_time == 1 else "s"
+        s3 = "" if string_count == 1 else "s"
         print(
-            f"Flamegraph data: {num_functions} root functions, total samples: 
{total_time}, "
-            f"{string_count} unique strings"
+            f"Flamegraph data: {num_functions} root function{s1}, "
+            f"{total_time} total sample{s2}, "
+            f"{string_count} unique string{s3}"
         )
 
         if num_functions == 0:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to