diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index ef12546..83c0bd7 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -716,6 +716,7 @@ class TerminalInteractiveShell(InteractiveShell): # This hook runs with each cycle of the `prompt_toolkit`'s event loop. self.active_eventloop, self._inputhook = get_inputhook_name_and_func(gui) else: + print(f'Disconnecting event loop {self._inputhook=}') self.active_eventloop = self._inputhook = None # For prompt_toolkit 3.0. We have to create an asyncio event loop with diff --git a/IPython/terminal/pt_inputhooks/qt.py b/IPython/terminal/pt_inputhooks/qt.py index d18a339..370494f 100644 --- a/IPython/terminal/pt_inputhooks/qt.py +++ b/IPython/terminal/pt_inputhooks/qt.py @@ -21,6 +21,9 @@ def _reclaim_excepthook(): sys.excepthook = shell.excepthook +announced = 0 + + def inputhook(context): global _appref app = QtCore.QCoreApplication.instance() @@ -57,7 +60,14 @@ def inputhook(context): QtCore.QTimer.singleShot(0, _reclaim_excepthook) event_loop = QtCore.QEventLoop(app) - print(f'`inputhook` running Qt {QtCore.qVersion()} event loop.\r') + global announced + if announced == 0: + print(f'`inputhook` running Qt {QtCore.qVersion()} event loop.\r') + announced += 1 + elif announced == 10: + announced = 0 + else: + announced += 1 if sys.platform == 'win32': # The QSocketNotifier method doesn't appear to work on Windows. # Use polling instead.