##// END OF EJS Templates
Merge pull request #11859 from terrdavis/master...
Matthias Bussonnier -
r25177:8971c8e5 merge
parent child Browse files
Show More
@@ -0,0 +1,15 b''
1 Expose Pdb API
2 ===================
3
4 Expose the built-in ``pdb.Pdb`` API. ``Pdb`` constructor arguments are generically
5 exposed, regardless of python version.
6 Newly exposed arguments:
7
8 - ``skip`` - Python 3.1+
9 - ``nosiginnt`` - Python 3.2+
10 - ``readrc`` - Python 3.6+
11
12 Try it out::
13
14 from IPython.terminal.debugger import TerminalPdb
15 pdb = TerminalPdb(skip=["skipthismodule"])
@@ -195,21 +195,6 b' def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):'
195 195 return wrapper
196 196
197 197
198 def _file_lines(fname):
199 """Return the contents of a named file as a list of lines.
200
201 This function never raises an IOError exception: if the file can't be
202 read, it simply returns an empty list."""
203
204 try:
205 outfile = open(fname)
206 except IOError:
207 return []
208 else:
209 with out:
210 return outfile.readlines()
211
212
213 198 class Pdb(OldPdb):
214 199 """Modified Pdb class, does not load readline.
215 200
@@ -219,7 +204,19 b' class Pdb(OldPdb):'
219 204 """
220 205
221 206 def __init__(self, color_scheme=None, completekey=None,
222 stdin=None, stdout=None, context=5):
207 stdin=None, stdout=None, context=5, **kwargs):
208 """Create a new IPython debugger.
209
210 :param color_scheme: Deprecated, do not use.
211 :param completekey: Passed to pdb.Pdb.
212 :param stdin: Passed to pdb.Pdb.
213 :param stdout: Passed to pdb.Pdb.
214 :param context: Number of lines of source code context to show when
215 displaying stacktrace information.
216 :param kwargs: Passed to pdb.Pdb.
217 The possibilities are python version dependent, see the python
218 docs for more info.
219 """
223 220
224 221 # Parent constructor:
225 222 try:
@@ -229,7 +226,8 b' class Pdb(OldPdb):'
229 226 except (TypeError, ValueError):
230 227 raise ValueError("Context must be a positive integer")
231 228
232 OldPdb.__init__(self, completekey, stdin, stdout)
229 # `kwargs` ensures full compatibility with stdlib's `pdb.Pdb`.
230 OldPdb.__init__(self, completekey, stdin, stdout, **kwargs)
233 231
234 232 # IPython changes...
235 233 self.shell = get_ipython()
@@ -19,6 +19,8 b' from prompt_toolkit.formatted_text import PygmentsTokens'
19 19
20 20
21 21 class TerminalPdb(Pdb):
22 """Standalone IPython debugger."""
23
22 24 def __init__(self, *args, **kwargs):
23 25 Pdb.__init__(self, *args, **kwargs)
24 26 self._ptcomp = None
General Comments 0
You need to be logged in to leave comments. Login now