summaryrefslogtreecommitdiffstats
path: root/lib/bb/exceptions.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-05-05 19:07:21 -0700
committerChris Larson <chris_larson@mentor.com>2011-05-16 12:39:41 -0700
commitb010c4d37cfff5f74747d7da8cc1bf6719e29357 (patch)
tree5c8d18bd079bf59f62fac22209570afe6df056f3 /lib/bb/exceptions.py
parent17a64df7e91438ee3fe1f7095c319f700a5372f1 (diff)
downloadbitbake-contrib-b010c4d37cfff5f74747d7da8cc1bf6719e29357.tar.gz
bb.exceptions: handle tb entries without context
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/exceptions.py')
-rw-r--r--lib/bb/exceptions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bb/exceptions.py b/lib/bb/exceptions.py
index e134ae136..86621d24b 100644
--- a/lib/bb/exceptions.py
+++ b/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: