From 881cad7dac97fd830d1639972215df65fc908829 2010-01-11 05:54:45 From: Fernando Perez Date: 2010-01-11 05:54:45 Subject: [PATCH] Added ability to invoke pdb on IPython crashes. For now it has to be turned on manually in the code, will add a flag later. But very useful for debugging apps that use/extend IPython itself and can possibly crash it. --- diff --git a/IPython/core/crashhandler.py b/IPython/core/crashhandler.py index d0de855..46a6594 100644 --- a/IPython/core/crashhandler.py +++ b/IPython/core/crashhandler.py @@ -41,7 +41,7 @@ class CrashHandler(object): def __init__(self,app, app_name, contact_name=None, contact_email=None, bug_tracker=None, crash_report_fname='CrashReport.txt', - show_crash_traceback=True): + show_crash_traceback=True, call_pdb=False): """New crash handler. Inputs: @@ -83,6 +83,8 @@ class CrashHandler(object): self.crash_report_fname = crash_report_fname self.show_crash_traceback = show_crash_traceback self.section_sep = '\n\n'+'*'*75+'\n\n' + self.call_pdb = call_pdb + #self.call_pdb = True # dbg # Hardcoded defaults, which can be overridden either by subclasses or # at runtime for the instance. @@ -133,8 +135,14 @@ $self.bug_tracker # properly expanded out in the user message template self.crash_report_fname = report_name TBhandler = ultratb.VerboseTB(color_scheme=color_scheme, - long_header=1) - traceback = TBhandler.text(etype,evalue,etb,context=31) + long_header=1, + call_pdb=self.call_pdb, + ) + if self.call_pdb: + TBhandler(etype,evalue,etb) + return + else: + traceback = TBhandler.text(etype,evalue,etb,context=31) # print traceback to screen if self.show_crash_traceback: