def test_enable_signals(self): import __pypy__, thread, time interrupted = [] lock = thread.allocate_lock() lock.acquire() def subthread(): try: time.sleep(0.5) with __pypy__.thread.signals_enabled: thread.interrupt_main() except BaseException, e: interrupted.append(e) finally:
def test_enable_signals(self): import __pypy__, thread, time interrupted = [] lock = thread.allocate_lock() lock.acquire() def subthread(): try: time.sleep(0.5) with __pypy__.thread.signals_enabled: thread.interrupt_main() except BaseException as e: interrupted.append(e) finally: lock.release() thread.start_new_thread(subthread, ()) lock.acquire() assert len(interrupted) == 1 assert 'KeyboardInterrupt' in interrupted[0].__class__.__name__