aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-10-14 09:57:42 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-10-14 10:17:49 +0300
commitf13bfc9a1e469983083b02e19cf963678ace66c0 (patch)
tree08bbf5b3ec11f1ce4aa614c451089b74caec35e2 /contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
parent82c487106cdf6fa8ae9a18967e53de52fb52e4e8 (diff)
downloadydb-f13bfc9a1e469983083b02e19cf963678ace66c0.tar.gz
Update contrib/python/ipython/py3 to 8.16.0
Diffstat (limited to 'contrib/python/ipython/py3/IPython/terminal/interactiveshell.py')
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/interactiveshell.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py b/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
index 37e0b86981..9b63159dfa 100644
--- a/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
+++ b/contrib/python/ipython/py3/IPython/terminal/interactiveshell.py
@@ -4,7 +4,7 @@ import asyncio
import os
import sys
from warnings import warn
-from typing import Union as UnionType
+from typing import Union as UnionType, Optional
from IPython.core.async_helpers import get_asyncio_loop
from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
@@ -912,8 +912,9 @@ class TerminalInteractiveShell(InteractiveShell):
if self._inputhook is not None:
self._inputhook(context)
- active_eventloop = None
- def enable_gui(self, gui=None):
+ active_eventloop: Optional[str] = None
+
+ def enable_gui(self, gui: Optional[str] = None) -> None:
if self.simple_prompt is True and gui is not None:
print(
f'Cannot install event loop hook for "{gui}" when running with `--simple-prompt`.'
@@ -928,8 +929,15 @@ class TerminalInteractiveShell(InteractiveShell):
return
if self._inputhook is not None and gui is not None:
- print(
- f"Shell is already running a gui event loop for {self.active_eventloop}. "
+ newev, newinhook = get_inputhook_name_and_func(gui)
+ if self._inputhook == newinhook:
+ # same inputhook, do nothing
+ self.log.info(
+ f"Shell is already running the {self.active_eventloop} eventloop. Doing nothing"
+ )
+ return
+ self.log.warning(
+ f"Shell is already running a different gui event loop for {self.active_eventloop}. "
"Call with no arguments to disable the current loop."
)
return