##// END OF EJS Templates
Move debugger_cls one class higher
Matthias Bussonnier -
Show More
@@ -207,7 +207,16 b' class TBTools(colorable.Colorable):'
207 207 # Number of frames to skip when reporting tracebacks
208 208 tb_offset = 0
209 209
210 def __init__(self, color_scheme='NoColor', call_pdb=False, ostream=None, parent=None, config=None):
210 def __init__(
211 self,
212 color_scheme="NoColor",
213 call_pdb=False,
214 ostream=None,
215 parent=None,
216 config=None,
217 *,
218 debugger_cls=None,
219 ):
211 220 # Whether to call the interactive pdb debugger after printing
212 221 # tracebacks or not
213 222 super(TBTools, self).__init__(parent=parent, config=config)
@@ -227,9 +236,10 b' class TBTools(colorable.Colorable):'
227 236
228 237 self.set_colors(color_scheme)
229 238 self.old_scheme = color_scheme # save initial value for toggles
239 self.debugger_cls = debugger_cls or debugger.Pdb
230 240
231 241 if call_pdb:
232 self.pdb = debugger.Pdb()
242 self.pdb = debugger_cls()
233 243 else:
234 244 self.pdb = None
235 245
@@ -628,8 +638,15 b' class VerboseTB(TBTools):'
628 638 tb_offset=1 allows use of this handler in interpreters which will have
629 639 their own code at the top of the traceback (VerboseTB will first
630 640 remove that frame before printing the traceback info)."""
631 TBTools.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
632 ostream=ostream, parent=parent, config=config)
641 TBTools.__init__(
642 self,
643 color_scheme=color_scheme,
644 call_pdb=call_pdb,
645 ostream=ostream,
646 parent=parent,
647 config=config,
648 debugger_cls=debugger_cls,
649 )
633 650 self.tb_offset = tb_offset
634 651 self.long_header = long_header
635 652 self.include_vars = include_vars
@@ -642,7 +659,6 b' class VerboseTB(TBTools):'
642 659 check_cache = linecache.checkcache
643 660 self.check_cache = check_cache
644 661
645 self.debugger_cls = debugger_cls or debugger.Pdb
646 662 self.skip_hidden = True
647 663
648 664 def format_record(self, frame_info):
@@ -907,7 +923,7 b' class VerboseTB(TBTools):'
907 923 fix that by hand after invoking the exception handler."""
908 924
909 925 if force or self.call_pdb:
910 if self.debugger_cls:
926 if self.pdb is None:
911 927 self.pdb = self.debugger_cls()
912 928 # the system displayhook may have changed, restore the original
913 929 # for pdb
General Comments 0
You need to be logged in to leave comments. Login now