Show More
@@ -60,6 +60,16 b' else:' | |||||
60 | # Allow the set_trace code to operate outside of an ipython instance, even if |
|
60 | # Allow the set_trace code to operate outside of an ipython instance, even if | |
61 | # it does so with some limitations. The rest of this support is implemented in |
|
61 | # it does so with some limitations. The rest of this support is implemented in | |
62 | # the Tracer constructor. |
|
62 | # the Tracer constructor. | |
|
63 | ||||
|
64 | def make_arrow(pad): | |||
|
65 | """generate the leading arrow in front of traceback or debugger""" | |||
|
66 | if pad >= 2: | |||
|
67 | return '-'*(pad-2) + '> ' | |||
|
68 | elif pad == 1: | |||
|
69 | return '>' | |||
|
70 | return '' | |||
|
71 | ||||
|
72 | ||||
63 | def BdbQuit_excepthook(et, ev, tb, excepthook=None): |
|
73 | def BdbQuit_excepthook(et, ev, tb, excepthook=None): | |
64 | """Exception hook which handles `BdbQuit` exceptions. |
|
74 | """Exception hook which handles `BdbQuit` exceptions. | |
65 |
|
75 | |||
@@ -460,21 +470,12 b' class Pdb(OldPdb):' | |||||
460 | if arrow: |
|
470 | if arrow: | |
461 | # This is the line with the error |
|
471 | # This is the line with the error | |
462 | pad = numbers_width - len(str(lineno)) - len(bp_mark) |
|
472 | pad = numbers_width - len(str(lineno)) - len(bp_mark) | |
463 | if pad >= 3: |
|
473 | num = '%s%s' % (make_arrow(pad), str(lineno)) | |
464 | marker = '-'*(pad-3) + '-> ' |
|
|||
465 | elif pad == 2: |
|
|||
466 | marker = '> ' |
|
|||
467 | elif pad == 1: |
|
|||
468 | marker = '>' |
|
|||
469 | else: |
|
|||
470 | marker = '' |
|
|||
471 | num = '%s%s' % (marker, str(lineno)) |
|
|||
472 | line = tpl_line % (bp_mark_color + bp_mark, num, line) |
|
|||
473 | else: |
|
474 | else: | |
474 | num = '%*s' % (numbers_width - len(bp_mark), str(lineno)) |
|
475 | num = '%*s' % (numbers_width - len(bp_mark), str(lineno)) | |
475 | line = tpl_line % (bp_mark_color + bp_mark, num, line) |
|
|||
476 |
|
476 | |||
477 | return line |
|
477 | return tpl_line % (bp_mark_color + bp_mark, num, line) | |
|
478 | ||||
478 |
|
479 | |||
479 | def list_command_pydb(self, arg): |
|
480 | def list_command_pydb(self, arg): | |
480 | """List command to use if we have a newer pydb installed""" |
|
481 | """List command to use if we have a newer pydb installed""" |
@@ -400,15 +400,7 b' def _format_traceback_lines(lnum, index, lines, Colors, lvals=None, scheme=None)' | |||||
400 | if i == lnum: |
|
400 | if i == lnum: | |
401 | # This is the line with the error |
|
401 | # This is the line with the error | |
402 | pad = numbers_width - len(str(i)) |
|
402 | pad = numbers_width - len(str(i)) | |
403 | if pad >= 3: |
|
403 | num = '%s%s' % (debugger.make_arrow(pad), str(lnum)) | |
404 | marker = '-' * (pad - 3) + '-> ' |
|
|||
405 | elif pad == 2: |
|
|||
406 | marker = '> ' |
|
|||
407 | elif pad == 1: |
|
|||
408 | marker = '>' |
|
|||
409 | else: |
|
|||
410 | marker = '' |
|
|||
411 | num = marker + str(i) |
|
|||
412 | line = '%s%s%s %s%s' % (Colors.linenoEm, num, |
|
404 | line = '%s%s%s %s%s' % (Colors.linenoEm, num, | |
413 | Colors.line, line, Colors.Normal) |
|
405 | Colors.line, line, Colors.Normal) | |
414 | else: |
|
406 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now