Nathaniel Smith added the comment:

(oh, in case it wasn't obvious: the advantage of raise() over kill() and 
pthread_kill() is that raise() works everywhere, including Windows, so it would 
avoid platform specific logic. Or if you don't like raise() for some reason 
then you can get the same effect by doing handler = PyOS_getsig(SIGINT); if 
(handler) handler(SIGINT); )

(Also, this is all assuming the python 3 logic on Windows. On Windows versions 
of python 2 I can't see any way to make time.sleep interruptible without 
significant rewriting. The problem is that on py2 the special Event used to 
signal the arrival of a control-C is a private variable that gets hooked up 
directly to Windows's low-level control-C logic, and there's effectively no way 
to get at it from outside. You might think GenerateConsoleCtrlEvent would help, 
but it is broken in too many ways for me to fit in this text box.)

----------

_______________________________________
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