Index: tools/telemetry/telemetry/exception_formatter.py |
diff --git a/tools/telemetry/telemetry/exception_formatter.py b/tools/telemetry/telemetry/exception_formatter.py |
index 553cca15023751c7d12481dc9377042e2bf667cd..8dafd44c2dae41923e6e446c2d92572b1b338323 100644 |
--- a/tools/telemetry/telemetry/exception_formatter.py |
+++ b/tools/telemetry/telemetry/exception_formatter.py |
@@ -48,7 +48,9 @@ def PrintFormattedException(exception_class, exception, tb): |
exception = ''.join([l[2:] if l[:2] == ' ' else l for l in |
traceback.format_exception_only(exception_class, |
exception)]) |
- local_variables = _GetFinalFrame(tb).tb_frame.f_locals |
+ local_variables = [(variable, value) for variable, value in |
+ _GetFinalFrame(tb).tb_frame.f_locals.iteritems() |
+ if variable != 'self'] |
# Format the traceback. |
print >> sys.stderr |
@@ -64,10 +66,8 @@ def PrintFormattedException(exception_class, exception, tb): |
if local_variables: |
print >> sys.stderr |
print >> sys.stderr, 'Locals:' |
- longest_variable = max([len(v) for v in local_variables.keys()]) |
- for variable, value in sorted(local_variables.iteritems()): |
- if variable == 'self': |
- continue |
+ longest_variable = max([len(v) for v, _ in local_variables]) |
+ for variable, value in sorted(local_variables): |
value = repr(value) |
possibly_truncated_value = _AbbreviateMiddle(value, ' ... ', 1024) |
truncation_indication = '' |