aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/terminal/debugger.py
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-09-30 10:27:28 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-09-30 10:47:10 +0300
commit5a6373c9d09bbfb7094f9992a4531477bb97829e (patch)
treeebea8fd55fee858876743312cdf789a1f01487b5 /contrib/python/ipython/py3/IPython/terminal/debugger.py
parent15f3c7493474de25a6b23296878bb8f49470d2e6 (diff)
downloadydb-5a6373c9d09bbfb7094f9992a4531477bb97829e.tar.gz
Update contrib/python/ipython/py3 to 8.15.0
Diffstat (limited to 'contrib/python/ipython/py3/IPython/terminal/debugger.py')
-rw-r--r--contrib/python/ipython/py3/IPython/terminal/debugger.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/python/ipython/py3/IPython/terminal/debugger.py b/contrib/python/ipython/py3/IPython/terminal/debugger.py
index 7a0623c847..19ed3c7f60 100644
--- a/contrib/python/ipython/py3/IPython/terminal/debugger.py
+++ b/contrib/python/ipython/py3/IPython/terminal/debugger.py
@@ -10,6 +10,7 @@ from . import embed
from pathlib import Path
from pygments.token import Token
+from prompt_toolkit.application import create_app_session
from prompt_toolkit.shortcuts.prompt import PromptSession
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.formatted_text import PygmentsTokens
@@ -95,6 +96,17 @@ class TerminalPdb(Pdb):
self.pt_loop = asyncio.new_event_loop()
self.pt_app = PromptSession(**options)
+ def _prompt(self):
+ """
+ In case other prompt_toolkit apps have to run in parallel to this one (e.g. in madbg),
+ create_app_session must be used to prevent mixing up between them. According to the prompt_toolkit docs:
+
+ > If you need multiple applications running at the same time, you have to create a separate
+ > `AppSession` using a `with create_app_session():` block.
+ """
+ with create_app_session():
+ return self.pt_app.prompt()
+
def cmdloop(self, intro=None):
"""Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
@@ -128,9 +140,7 @@ class TerminalPdb(Pdb):
# Run the prompt in a different thread.
if not _use_simple_prompt:
try:
- line = self.thread_executor.submit(
- self.pt_app.prompt
- ).result()
+ line = self.thread_executor.submit(self._prompt).result()
except EOFError:
line = "EOF"
else: