inputhook_qt4: handle KeyboardInterrupt in a way compatible with 'readline'....
inputhook_qt4: handle KeyboardInterrupt in a way compatible with 'readline'.
While the previous code works fine on Windows, on Linux with
'readline' the situation is different: once we disable the Qt4 event
loop, we go back waiting in the select() inside readline.c's
readline_until_enter_or_signal() function. When that select() is
interrupted, the PyOS_InputHook is executed if present and the pending
KeyboardInterrupt is delivered as soon as bytecode execution starts,
even before entering the `try:` clause! As at that point we're in a
ctypes callback, this will lead to an internal error. The only
solution is therefore to disable the PyOS_InputHook temporarily.