https://github.com/python/cpython/commit/2d4d26dd176a715609805b7f7b9fd2e39b6e2e3e commit: 2d4d26dd176a715609805b7f7b9fd2e39b6e2e3e branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-10-06T15:44:49Z summary:
[3.14] gh-74112: Fix race in test_interrupt_blocking_call (GH-158914) (GH-158920) On a loaded machine the KeyboardInterrupt could be raised before the main thread reached time.sleep(), escape the test and stop the whole regrtest run. (cherry picked from commit ea0ee925ad755999d6095ba61de2652ec9275f04) Co-authored-by: Christian Aurich Zanettini Martins <[email protected]> files: M Lib/idlelib/idle_test/test_run.py diff --git a/Lib/idlelib/idle_test/test_run.py b/Lib/idlelib/idle_test/test_run.py index bc762648c80785d..9f385ec43f60a26 100644 --- a/Lib/idlelib/idle_test/test_run.py +++ b/Lib/idlelib/idle_test/test_run.py @@ -546,9 +546,11 @@ def test_interrupt_blocking_call(self): # gh-74112: interrupt the main thread blocked in time.sleep(). timer = threading.Timer(0.1, self.ex.interrupt_the_server) self.addCleanup(timer.join) - timer.start() start = time.monotonic() with self.assertRaises(KeyboardInterrupt): + # On a loaded machine the signal can arrive before the main + # thread reaches time.sleep(), so start the timer in the block. + timer.start() time.sleep(support.SHORT_TIMEOUT) self.assertLess(time.monotonic() - start, support.SHORT_TIMEOUT / 2) _______________________________________________ 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]
