From 5175b0e6282ba1b60ea716470c867f7bc0a2b893 2011-10-01 03:05:14 From: MinRK Date: 2011-10-01 03:05:14 Subject: [PATCH] ensure excepthook is restored in OSXKernel mainloop also add some friendly whitespace per @fperez review --- diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 0d5c45a..3ad0d48 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -624,6 +624,7 @@ class OSXKernel(TkKernel): self.do_one_iteration() # and back: sys.excepthook = handle_int + t = TimerMac(poll_interval) t.add_callback(doi) t.start() @@ -651,6 +652,9 @@ class OSXKernel(TkKernel): except KeyboardInterrupt: # Ctrl-C shouldn't crash the kernel io.raw_print("KeyboardInterrupt caught in kernel") + finally: + # ensure excepthook is restored + sys.excepthook = real_excepthook #-----------------------------------------------------------------------------