Message290743
If you want to trigger the standard signal handling logic, then raise(SIGINT) is also an option. On unix it probably won't help because of issue 21895, but using raise() here + fixing 21895 by using pthread_kill in the c level signal handler would together give a pretty simple and robust way to pretend that the user hit control-C.
But... interrupt_main isn't documented to raise a SIGINT, it's documented to raise KeyboardInterrupt. These are very different, e.g. if the user has installed a custom handler or even set SIGINT to SIG_IGN or masked it. (In the later two cases, using pthread_kill to send a signal to the main thread *won't* interrupt any ongoing syscall.) This is *much* more difficult to make work correctly. And actually what IDLE wants is a fake control-C anyway!
So I'd suggest either redefining the semantics of interrupt_main to be "acts as if SIGINT was received" or else abandoning interrupt_main to its slightly-buggy semantics and adding a new function that does raise(SIGINT) and switching IDLE to use this new function. And fix issue 21895 in either case. |
|
Date |
User |
Action |
Args |
2017-03-28 16:55:02 | njs | set | recipients:
+ njs, terry.reedy, Mark, eryksun |
2017-03-28 16:55:02 | njs | set | messageid: <1490720102.91.0.27718171166.issue29926@psf.upfronthosting.co.za> |
2017-03-28 16:55:02 | njs | link | issue29926 messages |
2017-03-28 16:55:02 | njs | create | |
|