This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author njs
Recipients Mark, eryksun, njs, terry.reedy
Date 2017-03-28.16:55:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490720102.91.0.27718171166.issue29926@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-03-28 16:55:02njssetrecipients: + njs, terry.reedy, Mark, eryksun
2017-03-28 16:55:02njssetmessageid: <1490720102.91.0.27718171166.issue29926@psf.upfronthosting.co.za>
2017-03-28 16:55:02njslinkissue29926 messages
2017-03-28 16:55:02njscreate