From 699fdb409758f64763e77a5632256e73f617c459 2011-12-18 01:37:59 From: Fernando Perez Date: 2011-12-18 01:37:59 Subject: [PATCH] Clear inputhook after printing exception information. Makes this codepath more robust against KeyboardInterrupt raised during exception printing in Qt4 inputhook. Credit goes to @cboos for spotting this. --- diff --git a/IPython/lib/inputhookqt4.py b/IPython/lib/inputhookqt4.py index 71c6df6..a8dc349 100644 --- a/IPython/lib/inputhookqt4.py +++ b/IPython/lib/inputhookqt4.py @@ -98,10 +98,10 @@ def create_inputhook_qt4(mgr, app=None): mgr.clear_inputhook() except: # NO exceptions are allowed to escape from a ctypes callback ignore_CTRL_C() - mgr.clear_inputhook() from traceback import print_exc print_exc() print("Got exception from inputhook_qt4, unregistering.") + mgr.clear_inputhook() finally: allow_CTRL_C() return 0