|
@@
-387,13
+387,11
def _fixed_getinnerframes(etb, context=1, tb_offset=0):
|
|
387
|
# (SyntaxErrors have to be treated specially because they have no traceback)
|
|
387
|
# (SyntaxErrors have to be treated specially because they have no traceback)
|
|
388
|
|
|
388
|
|
|
389
|
|
|
389
|
|
|
390
|
def _format_traceback_lines(lnum, index, lines, Colors, lvals=None, scheme=None):
|
|
390
|
def _format_traceback_lines(lnum, index, lines, Colors, lvals=None, _line_format=(lambda x,_:x,None)):
|
|
391
|
numbers_width = INDENT_SIZE - 1
|
|
391
|
numbers_width = INDENT_SIZE - 1
|
|
392
|
res = []
|
|
392
|
res = []
|
|
393
|
i = lnum - index
|
|
393
|
i = lnum - index
|
|
394
|
|
|
394
|
|
|
395
|
_line_format = PyColorize.Parser(style=scheme).format2
|
|
|
|
|
396
|
|
|
|
|
|
397
|
for line in lines:
|
|
395
|
for line in lines:
|
|
398
|
line = py3compat.cast_unicode(line)
|
|
396
|
line = py3compat.cast_unicode(line)
|
|
399
|
|
|
397
|
|
|
@@
-586,9
+584,9
class ListTB(TBTools):
|
|
586
|
Because they are meant to be called without a full traceback (only a
|
|
584
|
Because they are meant to be called without a full traceback (only a
|
|
587
|
list), instances of this class can't call the interactive pdb debugger."""
|
|
585
|
list), instances of this class can't call the interactive pdb debugger."""
|
|
588
|
|
|
586
|
|
|
589
|
def __init__(self, color_scheme='NoColor', call_pdb=False, ostream=None, parent=None):
|
|
587
|
def __init__(self, color_scheme='NoColor', call_pdb=False, ostream=None, parent=None, config=None):
|
|
590
|
TBTools.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
|
|
588
|
TBTools.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
|
|
591
|
ostream=ostream, parent=parent)
|
|
589
|
ostream=ostream, parent=parent,config=config)
|
|
592
|
|
|
590
|
|
|
593
|
def __call__(self, etype, value, elist):
|
|
591
|
def __call__(self, etype, value, elist):
|
|
594
|
self.ostream.flush()
|
|
592
|
self.ostream.flush()
|
|
@@
-801,7
+799,8
class VerboseTB(TBTools):
|
|
801
|
|
|
799
|
|
|
802
|
def __init__(self, color_scheme='Linux', call_pdb=False, ostream=None,
|
|
800
|
def __init__(self, color_scheme='Linux', call_pdb=False, ostream=None,
|
|
803
|
tb_offset=0, long_header=False, include_vars=True,
|
|
801
|
tb_offset=0, long_header=False, include_vars=True,
|
|
804
|
check_cache=None, debugger_cls = None):
|
|
802
|
check_cache=None, debugger_cls = None,
|
|
|
|
|
803
|
parent=None, config=None):
|
|
805
|
"""Specify traceback offset, headers and color scheme.
|
|
804
|
"""Specify traceback offset, headers and color scheme.
|
|
806
|
|
|
805
|
|
|
807
|
Define how many frames to drop from the tracebacks. Calling it with
|
|
806
|
Define how many frames to drop from the tracebacks. Calling it with
|
|
@@
-809,7
+808,7
class VerboseTB(TBTools):
|
|
809
|
their own code at the top of the traceback (VerboseTB will first
|
|
808
|
their own code at the top of the traceback (VerboseTB will first
|
|
810
|
remove that frame before printing the traceback info)."""
|
|
809
|
remove that frame before printing the traceback info)."""
|
|
811
|
TBTools.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
|
|
810
|
TBTools.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
|
|
812
|
ostream=ostream)
|
|
811
|
ostream=ostream, parent=parent, config=config)
|
|
813
|
self.tb_offset = tb_offset
|
|
812
|
self.tb_offset = tb_offset
|
|
814
|
self.long_header = long_header
|
|
813
|
self.long_header = long_header
|
|
815
|
self.include_vars = include_vars
|
|
814
|
self.include_vars = include_vars
|
|
@@
-1010,9
+1009,10
class VerboseTB(TBTools):
|
|
1010
|
if index is None:
|
|
1009
|
if index is None:
|
|
1011
|
return level
|
|
1010
|
return level
|
|
1012
|
else:
|
|
1011
|
else:
|
|
|
|
|
1012
|
_line_format = PyColorize.Parser(style=col_scheme, parent=self).format2
|
|
1013
|
return '%s%s' % (level, ''.join(
|
|
1013
|
return '%s%s' % (level, ''.join(
|
|
1014
|
_format_traceback_lines(lnum, index, lines, Colors, lvals,
|
|
1014
|
_format_traceback_lines(lnum, index, lines, Colors, lvals,
|
|
1015
|
col_scheme)))
|
|
1015
|
_line_format)))
|
|
1016
|
|
|
1016
|
|
|
1017
|
def prepare_chained_exception_message(self, cause):
|
|
1017
|
def prepare_chained_exception_message(self, cause):
|
|
1018
|
direct_cause = "\nThe above exception was the direct cause of the following exception:\n"
|
|
1018
|
direct_cause = "\nThe above exception was the direct cause of the following exception:\n"
|
|
@@
-1277,7
+1277,8
class FormattedTB(VerboseTB, ListTB):
|
|
1277
|
def __init__(self, mode='Plain', color_scheme='Linux', call_pdb=False,
|
|
1277
|
def __init__(self, mode='Plain', color_scheme='Linux', call_pdb=False,
|
|
1278
|
ostream=None,
|
|
1278
|
ostream=None,
|
|
1279
|
tb_offset=0, long_header=False, include_vars=False,
|
|
1279
|
tb_offset=0, long_header=False, include_vars=False,
|
|
1280
|
check_cache=None, debugger_cls=None):
|
|
1280
|
check_cache=None, debugger_cls=None,
|
|
|
|
|
1281
|
parent=None, config=None):
|
|
1281
|
|
|
1282
|
|
|
1282
|
# NEVER change the order of this list. Put new modes at the end:
|
|
1283
|
# NEVER change the order of this list. Put new modes at the end:
|
|
1283
|
self.valid_modes = ['Plain', 'Context', 'Verbose']
|
|
1284
|
self.valid_modes = ['Plain', 'Context', 'Verbose']
|
|
@@
-1286,7
+1287,8
class FormattedTB(VerboseTB, ListTB):
|
|
1286
|
VerboseTB.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
|
|
1287
|
VerboseTB.__init__(self, color_scheme=color_scheme, call_pdb=call_pdb,
|
|
1287
|
ostream=ostream, tb_offset=tb_offset,
|
|
1288
|
ostream=ostream, tb_offset=tb_offset,
|
|
1288
|
long_header=long_header, include_vars=include_vars,
|
|
1289
|
long_header=long_header, include_vars=include_vars,
|
|
1289
|
check_cache=check_cache, debugger_cls=debugger_cls)
|
|
1290
|
check_cache=check_cache, debugger_cls=debugger_cls,
|
|
|
|
|
1291
|
parent=parent, config=config)
|
|
1290
|
|
|
1292
|
|
|
1291
|
# Different types of tracebacks are joined with different separators to
|
|
1293
|
# Different types of tracebacks are joined with different separators to
|
|
1292
|
# form a single string. They are taken from this dict
|
|
1294
|
# form a single string. They are taken from this dict
|
|
@@
-1415,8
+1417,8
class ColorTB(FormattedTB):
|
|
1415
|
class SyntaxTB(ListTB):
|
|
1417
|
class SyntaxTB(ListTB):
|
|
1416
|
"""Extension which holds some state: the last exception value"""
|
|
1418
|
"""Extension which holds some state: the last exception value"""
|
|
1417
|
|
|
1419
|
|
|
1418
|
def __init__(self, color_scheme='NoColor'):
|
|
1420
|
def __init__(self, color_scheme='NoColor', parent=None, config=None):
|
|
1419
|
ListTB.__init__(self, color_scheme)
|
|
1421
|
ListTB.__init__(self, color_scheme, parent=parent, config=config)
|
|
1420
|
self.last_syntax_error = None
|
|
1422
|
self.last_syntax_error = None
|
|
1421
|
|
|
1423
|
|
|
1422
|
def __call__(self, etype, value, elist):
|
|
1424
|
def __call__(self, etype, value, elist):
|