##// END OF EJS Templates
Maintain backwards compatibility in BdbQuit_excepthook.excepthook_ori.
Bradley M. Froehle -
Show More
@@ -27,6 +27,7 b' http://www.python.org/2.2.3/license.html"""'
27 27 from __future__ import print_function
28 28
29 29 import bdb
30 import functools
30 31 import linecache
31 32 import sys
32 33
@@ -59,11 +60,19 b' else:'
59 60 # Allow the set_trace code to operate outside of an ipython instance, even if
60 61 # it does so with some limitations. The rest of this support is implemented in
61 62 # the Tracer constructor.
62 def BdbQuit_excepthook(et,ev,tb,orig_hook):
63 def BdbQuit_excepthook(et, ev, tb, excepthook=None):
64 """Exception hook which handles `BdbQuit` exceptions.
65
66 All other exceptions are processed using the `excepthook`
67 parameter.
68 """
63 69 if et==bdb.BdbQuit:
64 70 print('Exiting Debugger.')
71 elif excepthook is not None:
72 excepthook(et, ev, tb)
65 73 else:
66 orig_hook(et,ev,tb)
74 # Backwards compatibility. Raise deprecation warning?
75 BdbQuit_excepthook.excepthook_ori(et,ev,tb)
67 76
68 77 def BdbQuit_IPython_excepthook(self,et,ev,tb,tb_offset=None):
69 78 print('Exiting Debugger.')
@@ -108,8 +117,8 b' class Tracer(object):'
108 117 ip = get_ipython()
109 118 except NameError:
110 119 # Outside of ipython, we set our own exception hook manually
111 sys.excepthook = lambda et, ev, tb, orig_hook=sys.excepthook: \
112 BdbQuit_excepthook(et, ev, tb, orig_hook)
120 sys.excepthook = functools.partial(BdbQuit_excepthook,
121 excepthook=sys.excepthook)
113 122 def_colors = 'NoColor'
114 123 try:
115 124 # Limited tab completion support
General Comments 0
You need to be logged in to leave comments. Login now