##// END OF EJS Templates
Backport PR #2717: One liner to fix debugger printing stack traces when lines of context are larger than source....
MinRK -
Show More
@@ -351,8 +351,8 b' class Pdb(OldPdb):'
351
351
352 start = lineno - 1 - context//2
352 start = lineno - 1 - context//2
353 lines = linecache.getlines(filename)
353 lines = linecache.getlines(filename)
354 start = max(start, 0)
355 start = min(start, len(lines) - context)
354 start = min(start, len(lines) - context)
355 start = max(start, 0)
356 lines = lines[start : start + context]
356 lines = lines[start : start + context]
357
357
358 for i,line in enumerate(lines):
358 for i,line in enumerate(lines):
@@ -121,3 +121,22 b' def test_ipdb_magics():'
121 Constructor Docstring:Docstring for ExampleClass.__init__
121 Constructor Docstring:Docstring for ExampleClass.__init__
122 ipdb> continue
122 ipdb> continue
123 '''
123 '''
124
125 def test_ipdb_magics():
126 '''Test ipdb with a very short function.
127
128 >>> def bar():
129 ... pass
130
131 Run ipdb.
132
133 >>> with PdbTestInput([
134 ... 'continue',
135 ... ]):
136 ... debugger.Pdb().runcall(bar)
137 > <doctest ...>(2)bar()
138 1 def bar():
139 ----> 2 pass
140 <BLANKLINE>
141 ipdb> continue
142 '''
General Comments 0
You need to be logged in to leave comments. Login now