diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-02 21:44:42 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-02 21:44:42 +0000 |
commit | 719c79fc5b526f35a6ea9be6f67f294fbe9c6001 (patch) | |
tree | a75ed391194366447c79fd1e6fe74b467c5ea438 /tools/telemetry | |
parent | 7a4e2538f65fd86518d29a30f5ec02da8cc531fc (diff) | |
download | chromium_src-719c79fc5b526f35a6ea9be6f67f294fbe9c6001.zip chromium_src-719c79fc5b526f35a6ea9be6f67f294fbe9c6001.tar.gz chromium_src-719c79fc5b526f35a6ea9be6f67f294fbe9c6001.tar.bz2 |
[Telemetry] Don't display "Locals:" header if there are no locals to print.
Doing the 'self' exclusion in the loop was too late.
BUG=
Review URL: https://codereview.chromium.org/94033003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/telemetry')
-rw-r--r-- | tools/telemetry/telemetry/exception_formatter.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/telemetry/telemetry/exception_formatter.py b/tools/telemetry/telemetry/exception_formatter.py index 553cca1..8dafd44 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 = '' |