From 63d14f474d52430f19653ef7ed881cd8dbaf3f42 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 5 May 2011 19:07:21 -0700 Subject: bb.exceptions: handle tb entries without context (Bitbake rev: b010c4d37cfff5f74747d7da8cc1bf6719e29357) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/exceptions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/exceptions.py b/bitbake/lib/bb/exceptions.py index e134ae136d..86621d24ba 100644 --- a/bitbake/lib/bb/exceptions.py +++ b/bitbake/lib/bb/exceptions.py @@ -8,10 +8,13 @@ from collections import namedtuple class TracebackEntry(namedtuple.abc): """Pickleable representation of a traceback entry""" _fields = 'filename lineno function args code_context index' - _header = ' File "{0.filename}", line {0.lineno}, in {0.function}{0.args}:\n' + _header = ' File "{0.filename}", line {0.lineno}, in {0.function}{0.args}' def format(self, formatter=None): - formatted = [self._header.format(self)] + if not self.code_context: + return self._header.format(self) + '\n' + + formatted = [self._header.format(self) + ':\n'] for lineindex, line in enumerate(self.code_context): if formatter: -- cgit v1.2.3-54-g00ecf