From 53320003433f3d9fdc47cd9eaedd2b9444ab86de 2016-08-05 08:10:56 From: Min RK Date: 2016-08-05 08:10:56 Subject: [PATCH] Allow starting TerminalInteractiveShell more than once 1. always start with keep_running=True in `interact()` 2. don't close eventloop at end of mainloop (not sure this is the right thing to do) --- diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index 077d92c..ef8cd3f 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -415,6 +415,7 @@ class TerminalInteractiveShell(InteractiveShell): if display_banner is not DISPLAY_BANNER_DEPRECATED: warn('interact `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2) + self.keep_running = True while self.keep_running: print(self.separate_in, end='') @@ -440,9 +441,6 @@ class TerminalInteractiveShell(InteractiveShell): break except KeyboardInterrupt: print("\nKeyboardInterrupt escaped interact()\n") - - if hasattr(self, '_eventloop'): - self._eventloop.close() _inputhook = None def inputhook(self, context):