##// END OF EJS Templates
Backport PR #13002: Document how to change the default predicates for the debugger.
Matthias Bussonnier -
Show More
@@ -199,21 +199,39 b' class Pdb(OldPdb):'
199 for a standalone version that uses prompt_toolkit, see
199 for a standalone version that uses prompt_toolkit, see
200 `IPython.terminal.debugger.TerminalPdb` and
200 `IPython.terminal.debugger.TerminalPdb` and
201 `IPython.terminal.debugger.set_trace()`
201 `IPython.terminal.debugger.set_trace()`
202
203
204 This debugger can hide and skip frames that are tagged according to some predicates.
205 See the `skip_predicates` commands.
206
202 """
207 """
203
208
209 default_predicates = {"tbhide": True, "readonly": False, "ipython_internal": True}
210
204 def __init__(self, color_scheme=None, completekey=None,
211 def __init__(self, color_scheme=None, completekey=None,
205 stdin=None, stdout=None, context=5, **kwargs):
212 stdin=None, stdout=None, context=5, **kwargs):
206 """Create a new IPython debugger.
213 """Create a new IPython debugger.
207
214
208 :param color_scheme: Deprecated, do not use.
215 Parameters
209 :param completekey: Passed to pdb.Pdb.
216 ----------
210 :param stdin: Passed to pdb.Pdb.
217 color_scheme : default None
211 :param stdout: Passed to pdb.Pdb.
218 Deprecated, do not use.
212 :param context: Number of lines of source code context to show when
219 completekey : default None
220 Passed to pdb.Pdb.
221 stdin : default None
222 Passed to pdb.Pdb.
223 stdout : default None
224 Passed to pdb.Pdb.
225 context : int
226 Number of lines of source code context to show when
213 displaying stacktrace information.
227 displaying stacktrace information.
214 :param kwargs: Passed to pdb.Pdb.
228 **kwargs
215 The possibilities are python version dependent, see the python
229 Passed to pdb.Pdb.
216 docs for more info.
230
231 Notes
232 -----
233 The possibilities are python version dependent, see the python
234 docs for more info.
217 """
235 """
218
236
219 # Parent constructor:
237 # Parent constructor:
@@ -285,7 +303,7 b' class Pdb(OldPdb):'
285 self.report_skipped = True
303 self.report_skipped = True
286
304
287 # list of predicates we use to skip frames
305 # list of predicates we use to skip frames
288 self._predicates = {"tbhide": True, "readonly": False, "ipython_internal": True}
306 self._predicates = self.default_predicates
289
307
290 def set_colors(self, scheme):
308 def set_colors(self, scheme):
291 """Shorthand access to the color table scheme selector method."""
309 """Shorthand access to the color table scheme selector method."""
@@ -553,6 +571,10 b' class Pdb(OldPdb):'
553
571
554 Call without arguments to see the current values.
572 Call without arguments to see the current values.
555
573
574 To permanently change the value of an option add the corresponding
575 command to your ``~/.pdbrc`` file. If you are programmatically using the
576 Pdb instance you can also change the ``default_predicates`` class
577 attribute.
556 """
578 """
557 if not args.strip():
579 if not args.strip():
558 print("current predicates:")
580 print("current predicates:")
@@ -64,6 +64,22 b' Note that the ``readonly`` predicate may increase disk access as we check for'
64 file access permission for all frames on many command invocation, but is usually
64 file access permission for all frames on many command invocation, but is usually
65 cached by operating systems. Let us know if you encounter any issues.
65 cached by operating systems. Let us know if you encounter any issues.
66
66
67 As the IPython debugger does not use the traitlets infrastructure for
68 configuration, by editing your ``.pdbrc`` files and appending commands you would
69 like to be executed just before entering the interactive prompt. For example:
70
71
72 .. code::
73
74 # file : ~/.pdbrc
75 skip_predicates readonly True
76 skip_predicates tbhide False
77
78 Will hide read only frames by default and show frames marked with
79 ``__tracebackhide__``.
80
81
82
67
83
68 Thanks
84 Thanks
69 ------
85 ------
@@ -236,14 +252,14 b' was exceptionally no release last month.'
236 - Docs docs formatting that make the install commands work on zsh
252 - Docs docs formatting that make the install commands work on zsh
237 :ghpull:`12587`
253 :ghpull:`12587`
238 - Always display the last frame in tracebacks even if hidden with
254 - Always display the last frame in tracebacks even if hidden with
239 ``__traceback_hide__`` :ghpull:`12601`
255 ``__tracebackhide__`` :ghpull:`12601`
240 - Avoid an issue where a callback can be registered multiple times.
256 - Avoid an issue where a callback can be registered multiple times.
241 :ghpull:`12625`
257 :ghpull:`12625`
242 - Avoid an issue in debugger mode where frames changes could be lost.
258 - Avoid an issue in debugger mode where frames changes could be lost.
243 :ghpull:`12627`
259 :ghpull:`12627`
244
260
245 - Never hide the frames that invoke a debugger, even if marked as hidden by
261 - Never hide the frames that invoke a debugger, even if marked as hidden by
246 ``__traceback_hide__`` :ghpull:`12631`
262 ``__tracebackhide__`` :ghpull:`12631`
247 - Fix calling the debugger in a recursive manner :ghpull:`12659`
263 - Fix calling the debugger in a recursive manner :ghpull:`12659`
248
264
249
265
@@ -394,7 +410,7 b' Change of API and exposed objects automatically detected using `frappuccino'
394 <https://pypi.org/project/frappuccino/>`_ (still in beta):
410 <https://pypi.org/project/frappuccino/>`_ (still in beta):
395
411
396
412
397 The following items are new and mostly related to understanding ``__tracebackbhide__``::
413 The following items are new and mostly related to understanding ``__tracebackbide__``::
398
414
399 + IPython.core.debugger.Pdb.do_down(self, arg)
415 + IPython.core.debugger.Pdb.do_down(self, arg)
400 + IPython.core.debugger.Pdb.do_skip_hidden(self, arg)
416 + IPython.core.debugger.Pdb.do_skip_hidden(self, arg)
General Comments 0
You need to be logged in to leave comments. Login now