[Python-modules-commits] [ipdb] 03/11: add `_get_debugger_cls`
Andrey Rahmatullin
wrar at moszumanska.debian.org
Thu Jan 18 17:50:19 UTC 2018
This is an automated email from the git hooks/post-receive script.
wrar pushed a commit to annotated tag 0.10.2
in repository ipdb.
commit 9cd32f202c03cd1e985feb5f003c2c6b115e1db2
Author: Joseph Kahn <josephbkahn at gmail.com>
Date: Sat Aug 6 11:56:33 2016 -0400
add `_get_debugger_cls`
---
ipdb/__main__.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ipdb/__main__.py b/ipdb/__main__.py
index 030bab2..31b0409 100644
--- a/ipdb/__main__.py
+++ b/ipdb/__main__.py
@@ -23,14 +23,16 @@ def import_module(possible_modules, needed_module):
count -= 1
if count == 0:
raise
+
+from IPython import version_info as ipython_version
+from IPython.terminal.interactiveshell import TerminalInteractiveShell
+
try:
# IPython 5.0 and newer
+ from IPython.terminal.debugger import TerminalPdb as Pdb
from IPython.core.debugger import BdbQuit_excepthook
- from IPython.terminal.interactiveshell import TerminalInteractiveShell
- debugger_cls = TerminalInteractiveShell().debugger_cls
except ImportError:
from IPython.core.debugger import Pdb, BdbQuit_excepthook
- debugger_cls = Pdb
possible_modules = ['IPython.terminal.ipapp', # Newer IPython
'IPython.frontend.terminal.ipapp'] # Older IPython
@@ -71,7 +73,14 @@ else:
def_exec_lines = [line + '\n' for line in ipapp.exec_lines]
+def _get_debugger_cls():
+ if ipython_version < (5, 0, 0):
+ return Pdb
+ return TerminalInteractiveShell().debugger_cls
+
+
def _init_pdb(context=3):
+ debugger_cls = _get_debugger_cls()
if 'context' in getargspec(debugger_cls.__init__)[0]:
p = debugger_cls(def_colors, context=context)
else:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/ipdb.git
More information about the Python-modules-commits
mailing list