From 3524a2fe32b14b8dfa4e176d38f43165f9422304 Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Thu, 6 Mar 2025 15:25:27 +0000 Subject: [PATCH] gh-130917: update workload for test_signal.test_itimer_virtual The workload to advance the virtual timeout is too lightweight for some platforms. As result the test goes in timeout as it never reaches the end of the timer. By having a heavier workload, the virtual timer advances rapidly and the SIGVTALRM is sent before the timeout. --- Lib/test/test_signal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 72a01cd1e451f4..b7b2de0c556247 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -842,7 +842,7 @@ def test_itimer_virtual(self): for _ in support.busy_retry(support.LONG_TIMEOUT): # use up some virtual time by doing real work - _ = pow(12345, 67890, 10000019) + _ = sum(i * i for i in range(10**5)) if signal.getitimer(self.itimer) == (0.0, 0.0): # sig_vtalrm handler stopped this itimer break @@ -859,7 +859,7 @@ def test_itimer_prof(self): for _ in support.busy_retry(support.LONG_TIMEOUT): # do some work - _ = pow(12345, 67890, 10000019) + _ = sum(i * i for i in range(10**5)) if signal.getitimer(self.itimer) == (0.0, 0.0): # sig_prof handler stopped this itimer break