Terry J. Reedy added the comment: Scratch my confusion. I added "print('after')" immediately after _thread.interrupt_main() in idlelib.run.Executor.interrupt_the_server() and 'after' is printed in Shell right after I hit ^C but a time.sleep(10) is not immediately interrupted and 'KeyboardInterrupt' does not show for nearly 10 seconds. I don't know if this is a bug or unavoidable limitation not mentioned in the _thread doc. I might be system dependent. https://docs.python.org/3/library/_thread.html#_thread.interrupt_main
---------- assignee: terry.reedy -> components: +Library (Lib) -IDLE title: time.sleep ignores keyboard interrupt in IDLE -> time.sleep ignores _thread.interrupt_main() versions: -Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29926> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com