Skip to content

Commit 5c57ffe

Browse files
shaperilioCarreau
authored andcommitted
Don't allow switching gui without detatching
1 parent 4d707a6 commit 5c57ffe

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎IPython/terminal/interactiveshell.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,8 @@ def inputhook(self, context):
712712
active_eventloop = None
713713
def enable_gui(self, gui=None):
714714
print(f'Someone called `enable_gui` with {gui=}.')
715+
if self._inputhook is not None and gui is not None:
716+
raise RuntimeError("Shell already running a gui event loop.")
715717
if gui and (gui not in {"inline", "webagg"}):
716718
# This hook runs with each cycle of the `prompt_toolkit`'s event loop.
717719
self.active_eventloop, self._inputhook = get_inputhook_name_and_func(gui)

0 commit comments

Comments
 (0)