https://github.com/python/cpython/commit/be4ee8ee420adb211b77645f30ca1eb9356ed1c0
commit: be4ee8ee420adb211b77645f30ca1eb9356ed1c0
branch: main
author: Maurycy Pawłowski-Wieroński <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-01-30T15:13:21Z
summary:
gh-144342: Use `time.sleep` in `profiling.sampling` (#144343)
files:
M Lib/profiling/sampling/sample.py
diff --git a/Lib/profiling/sampling/sample.py b/Lib/profiling/sampling/sample.py
index f657849e72bb62..c6abfb1c8ee885 100644
--- a/Lib/profiling/sampling/sample.py
+++ b/Lib/profiling/sampling/sample.py
@@ -100,7 +100,11 @@ def sample(self, collector, duration_sec=None, *,
async_aware=False):
break
current_time = time.perf_counter()
- if next_time < current_time:
+ if next_time > current_time:
+ sleep_time = (next_time - current_time) * 0.9
+ if sleep_time > 0.0001:
+ time.sleep(sleep_time)
+ elif next_time < current_time:
try:
with _pause_threads(self.unwinder, self.blocking):
if async_aware == "all":
_______________________________________________
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]