Antoine Pitrou added the comment:

Please step back a bit and read the implementation of interrupt_main(): it 
calls PyErr_SetInterrupt() (in signalmodule.c!), which merely sets an internal 
flag saying SIGINT was received.

So, there: PyErr_SetInterrupt() already behaves like SIGINT, *except* that it 
doesn't actually deliver a C signal, it merely sets a flag.  Which is the 
reason that it fails waking up C syscalls like select().

Demonstration:

>>> def handler(signum, frame):
...     print("got signal %d!" % (signum,))
... 
>>> signal.signal(signal.SIGINT, handler)
<built-in function default_int_handler>
>>> _thread.interrupt_main()
got signal 2!


In the end, making interrupt_main() *actually* deliver a SIGINT instead of 
merely setting the internal flag for it will certainly be true to the original 
intent.

----------

_______________________________________
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