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