Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: tools/telemetry/telemetry/exception_formatter.py

Issue 94033003: [Telemetry] Don't display "Locals:" header if there are no locals to print. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dtu comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = ''
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698