##// END OF EJS Templates
Start embedded IPython shell for ipdb interact, #12913
Iwan Briquemont -
Show More
@@ -0,0 +1,4 b''
1 IPython shell for ipdb interact
2 -------------------------------
3
4 The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
@@ -7,6 +7,7 b' from IPython.core.debugger import Pdb'
7 from IPython.core.completer import IPCompleter
7 from IPython.core.completer import IPCompleter
8 from .ptutils import IPythonPTCompleter
8 from .ptutils import IPythonPTCompleter
9 from .shortcuts import create_ipython_shortcuts
9 from .shortcuts import create_ipython_shortcuts
10 from . import embed
10
11
11 from pygments.token import Token
12 from pygments.token import Token
12 from prompt_toolkit.shortcuts.prompt import PromptSession
13 from prompt_toolkit.shortcuts.prompt import PromptSession
@@ -131,6 +132,18 b' class TerminalPdb(Pdb):'
131 except Exception:
132 except Exception:
132 raise
133 raise
133
134
135 def do_interact(self, arg):
136 ipshell = embed.InteractiveShellEmbed(
137 config=self.shell.config,
138 banner1="*interactive*",
139 exit_msg="now exiting InteractiveConsole...",
140 )
141 global_ns = self.curframe.f_globals
142 ipshell(
143 module=sys.modules.get(global_ns["__name__"], None),
144 local_ns=self.curframe_locals,
145 )
146
134
147
135 def set_trace(frame=None):
148 def set_trace(frame=None):
136 """
149 """
General Comments 0
You need to be logged in to leave comments. Login now