##// END OF EJS Templates
Merge pull request #9731 from anntzer/simplify-debugger...
Matthias Bussonnier -
r22704:eece8e84 merge
parent child Browse files
Show More
@@ -30,6 +30,7 b' import bdb'
30 import functools
30 import functools
31 import inspect
31 import inspect
32 import sys
32 import sys
33 import warnings
33
34
34 from IPython import get_ipython
35 from IPython import get_ipython
35 from IPython.utils import PyColorize, ulinecache
36 from IPython.utils import PyColorize, ulinecache
@@ -62,6 +63,8 b' def BdbQuit_excepthook(et, ev, tb, excepthook=None):'
62 All other exceptions are processed using the `excepthook`
63 All other exceptions are processed using the `excepthook`
63 parameter.
64 parameter.
64 """
65 """
66 warnings.warn("`BdbQuit_excepthook` is deprecated since version 5.1",
67 DeprecationWarning)
65 if et==bdb.BdbQuit:
68 if et==bdb.BdbQuit:
66 print('Exiting Debugger.')
69 print('Exiting Debugger.')
67 elif excepthook is not None:
70 elif excepthook is not None:
@@ -70,7 +73,11 b' def BdbQuit_excepthook(et, ev, tb, excepthook=None):'
70 # Backwards compatibility. Raise deprecation warning?
73 # Backwards compatibility. Raise deprecation warning?
71 BdbQuit_excepthook.excepthook_ori(et,ev,tb)
74 BdbQuit_excepthook.excepthook_ori(et,ev,tb)
72
75
76
73 def BdbQuit_IPython_excepthook(self,et,ev,tb,tb_offset=None):
77 def BdbQuit_IPython_excepthook(self,et,ev,tb,tb_offset=None):
78 warnings.warn(
79 "`BdbQuit_IPython_excepthook` is deprecated since version 5.1",
80 DeprecationWarning)
74 print('Exiting Debugger.')
81 print('Exiting Debugger.')
75
82
76
83
@@ -114,6 +121,9 b' class Tracer(object):'
114 step through code, set breakpoints, etc. See the pdb documentation
121 step through code, set breakpoints, etc. See the pdb documentation
115 from the Python standard library for usage details.
122 from the Python standard library for usage details.
116 """
123 """
124 warnings.warn("`Tracer` is deprecated since version 5.1, directly use "
125 "`IPython.core.debugger.Pdb.set_trace()`",
126 DeprecationWarning)
117
127
118 ip = get_ipython()
128 ip = get_ipython()
119 if ip is None:
129 if ip is None:
@@ -189,12 +199,12 b' def _file_lines(fname):'
189 class Pdb(OldPdb, object):
199 class Pdb(OldPdb, object):
190 """Modified Pdb class, does not load readline."""
200 """Modified Pdb class, does not load readline."""
191
201
192 def __init__(self,color_scheme='NoColor',completekey=None,
202 def __init__(self, color_scheme=None, completekey=None,
193 stdin=None, stdout=None, context=5):
203 stdin=None, stdout=None, context=5):
194
204
195 # Parent constructor:
205 # Parent constructor:
196 try:
206 try:
197 self.context=int(context)
207 self.context = int(context)
198 if self.context <= 0:
208 if self.context <= 0:
199 raise ValueError("Context must be a positive integer")
209 raise ValueError("Context must be a positive integer")
200 except (TypeError, ValueError):
210 except (TypeError, ValueError):
@@ -211,6 +221,13 b' class Pdb(OldPdb, object):'
211 TerminalInteractiveShell
221 TerminalInteractiveShell
212 self.shell = TerminalInteractiveShell.instance()
222 self.shell = TerminalInteractiveShell.instance()
213
223
224 if color_scheme is not None:
225 warnings.warn(
226 "The `color_scheme` argument is deprecated since version 5.1",
227 DeprecationWarning)
228 else:
229 color_scheme = self.shell.colors
230
214 self.aliases = {}
231 self.aliases = {}
215
232
216 # Create color table: we copy the default one from the traceback
233 # Create color table: we copy the default one from the traceback
@@ -250,6 +267,12 b' class Pdb(OldPdb, object):'
250 """Shorthand access to the color table scheme selector method."""
267 """Shorthand access to the color table scheme selector method."""
251 self.color_scheme_table.set_active_scheme(scheme)
268 self.color_scheme_table.set_active_scheme(scheme)
252
269
270 def trace_dispatch(self, frame, event, arg):
271 try:
272 return super(Pdb, self).trace_dispatch(frame, event, arg)
273 except bdb.BdbQuit:
274 pass
275
253 def interaction(self, frame, traceback):
276 def interaction(self, frame, traceback):
254 try:
277 try:
255 OldPdb.interaction(self, frame, traceback)
278 OldPdb.interaction(self, frame, traceback)
@@ -801,7 +801,7 b' python-profiler package from non-free.""")'
801 If the break point given by `bp_line` is not valid.
801 If the break point given by `bp_line` is not valid.
802
802
803 """
803 """
804 deb = debugger.Pdb(self.shell.colors)
804 deb = debugger.Pdb()
805 # reset Breakpoint state, which is moronically kept
805 # reset Breakpoint state, which is moronically kept
806 # in a class
806 # in a class
807 bdb.Breakpoint.next = 1
807 bdb.Breakpoint.next = 1
General Comments 0
You need to be logged in to leave comments. Login now