Cause calling interrupt_main in main thread raise KeyboardInterrupt instantly.

This commit is contained in:
Brett Cannon 2003-06-13 23:56:32 +00:00
parent 4e64d78bbb
commit 91012fe9b5
2 changed files with 17 additions and 4 deletions

View file

@ -109,6 +109,11 @@ class MiscTests(unittest.TestCase):
_thread.interrupt_main()
self.failUnlessRaises(KeyboardInterrupt, _thread.start_new_thread,
call_interrupt, tuple())
def test_interrupt_in_main(self):
# Make sure that if interrupt_main is called in main threat that
# KeyboardInterrupt is raised instantly.
self.failUnlessRaises(KeyboardInterrupt, _thread.interrupt_main)
class ThreadTests(unittest.TestCase):
"""Test thread creation."""