Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gh-74112: Fix race in test_interrupt_blocking_call (GH-158914)
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 ea0ee92)
  • Loading branch information
christianaurichzm authored and serhiy-storchaka committed Oct 6, 2026
commit c73527f7eac89d5189dc805750cbc4bc5d28a885
4 changes: 3 additions & 1 deletion Lib/idlelib/idle_test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,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)

Expand Down
Loading