Issue1360
Created on 2007-10-30 00:06 by piro, last changed 2007-10-30 01:38 by piro.
|
msg56942 - (view) |
Author: Daniele Varrazzo (piro) |
Date: 2007-10-30 00:06 |
|
This issue probably depends on #1167930
When waiting on a queue in blocking mode, in no timeout is set, ctrl-C
doesn't raise KeyboardInterrupt::
q = Queue()
q.get(True)
# ctrl-c doesn't work here
If any timeout is set, ctrl-c works as expected::
q = Queue()
ONEYEAR = 365 * 24 * 60 * 60
q.get(True, ONEYEAR)
# ctrl-c works here
Traceback (most recent call last):
File "queuebug.py", line 6, in <module>
q.get(True, ONEYEAR)
File "/usr/lib/python2.5/Queue.py", line 174, in get
self.not_empty.wait(remaining)
File "/usr/lib/python2.5/threading.py", line 233, in wait
_sleep(delay)
KeyboardInterrupt
|
|
msg56945 - (view) |
Author: Guido van Rossum (gvanrossum) |
Date: 2007-10-30 00:53 |
|
This (and the other issue you mention) is because the regular acquire()
method on a basic lock cannot be interrupted. That's unlikely to go
away, so you'll just have to live with this. As you've discovered,
specifying a timeout solves the issue. Since code running in threads
doesn't receive signals anyway (in Python), it would be fairly pointless
to slow down lock acquisition in order to support keyboard interrupts.
|
|
msg56950 - (view) |
Author: Daniele Varrazzo (piro) |
Date: 2007-10-30 01:38 |
|
Because the easy workaround, we can live with the issue. Anyway, because
the workaround is not trivial to find, and because the behavior is
supposed to remain unchanged, maybe the issue should be mentioned in the
docs.
Thank you for the explanation :)
|
|
| Date |
User |
Action |
Args |
| 2007-10-30 01:38:35 | piro | set | messages:
+ msg56950 |
| 2007-10-30 00:53:11 | gvanrossum | set | status: open -> closed resolution: wont fix messages:
+ msg56945 nosy:
+ gvanrossum |
| 2007-10-30 00:06:30 | piro | create | |
|