Message297345
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. |
|
Date |
User |
Action |
Args |
2017-06-30 07:46:22 | pitrou | set | recipients:
+ pitrou, terry.reedy, njs, martin.panter, Mark, eryksun, louielu |
2017-06-30 07:46:22 | pitrou | set | messageid: <1498808782.41.0.843066455437.issue29926@psf.upfronthosting.co.za> |
2017-06-30 07:46:22 | pitrou | link | issue29926 messages |
2017-06-30 07:46:22 | pitrou | create | |
|