New submission from Mark:

Consider the following code, typed interactively:

>>> import time
>>> time.sleep(1e6)

This will sleep for a bit over one and a half weeks.  If this was typed in 
error, you may want to interrupt it.  If using the command line, this is easy: 
just use Ctrl-C.  If using IDLE, Ctrl-C has no effect.  One could attempt to 
restart the shell with Ctrl-F6, which seems to work, but in fact the process 
remains in the background, hung until the timeout expires.  There are two 
obvious workarounds: one is to sleep in a separate thread, so as to avoid 
blocking the main thread, and the other is to use a loop with smaller sleep 
increments:

for ii in range(1e5): sleep(10)

Now it only takes 10 seconds to interrupt a sleep.  But these are both clumsy 
workarounds.  They're so clumsy that I think I'm not going to use IDLE for this 
particular program and just use python -I.  Would be nice if this were fixed.

----------
assignee: terry.reedy
components: IDLE
messages: 290663
nosy: Mark, terry.reedy
priority: normal
severity: normal
status: open
title: time.sleep ignores keyboard interrupt in IDLE
versions: Python 2.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

Reply via email to