Nathaniel Smith added the comment:

In terms of general design cleanliness, I think it would be better to make 
`interrupt_main` work reliably than to have IDLE add workarounds for its 
unreliability.

AFAICT the ideal, minimal redundancy solution would be:

- interrupt_main just calls raise(SIGINT)
- bpo-21895 is fixed by adding a few lines to Python's C-level signal handler 
on Unix-likes to check if it's running in the main thread, and if not then use 
pthread_kill to redirect the signal to the main thread.

If trying to fix bpo-28195 is too controversial, then a minimal change would be:

- in interrupt_main, if we're on Windows, call raise(SIGINT); otherwise, call 
pthread_kill(main_thread, SIGINT)

And in either case we'd also have to document that interrupt_main is now 
equivalent to the user having hit control-C. But AFAICT that's what all its 
users really want anyway.

----------

_______________________________________
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