From f1cebeb5de8984c11b1ada2ab4ed2f4e094910a0 2017-01-29 21:37:01 From: Thomas Kluyver Date: 2017-01-29 21:37:01 Subject: [PATCH] Put cleanup in finally block As suggested on gh-9867 --- diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index df20420..7b99c73 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -429,6 +429,7 @@ class TerminalInteractiveShell(InteractiveShell): break except KeyboardInterrupt as e: print("\n%s escaped interact()\n" % type(e).__name__) + finally: # An interrupt during the eventloop will mess up the # internal state of the prompt_toolkit library. # Stopping the eventloop fixes this, see