summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-24 14:23:44 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-24 14:36:32 +0100
commit9ec0429271e68527a55fc123dea5a1b959c6ec3b (patch)
treed0c9441849f43d671069c266dc1355670a5bf897
parent4de24ccc10e40cc088b8515095df59f69b12715d (diff)
downloadbitbake-9ec0429271e68527a55fc123dea5a1b959c6ec3b.tar.gz
bitbake/exceptions: Handle reports from the field of exception code failures
Despite using python 2.6, there have been reports of issues where bitbake is printing tracebacks with errors in the exception handling code. This was masking the real error. Since we need to do whatever we can to give the user good feedback about errors, detect the tuple instead of namedtuple case and don't fault in the exception handler but just give up trying to traceback any further. In the reported cases, this gives a message the user can then understand. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/exceptions.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/bb/exceptions.py b/lib/bb/exceptions.py
index 4dd3e2cc3..f182c8fd6 100644
--- a/lib/bb/exceptions.py
+++ b/lib/bb/exceptions.py
@@ -32,7 +32,14 @@ class TracebackEntry(namedtuple.abc):
def _get_frame_args(frame):
"""Get the formatted arguments and class (if available) for a frame"""
arginfo = inspect.getargvalues(frame)
- if not arginfo.args:
+
+ try:
+ if not arginfo.args:
+ return '', None
+ # There have been reports from the field of python 2.6 which doesn't
+ # return a namedtuple here but simply a tuple so fallback gracefully if
+ # args isn't present.
+ except AttributeError:
return '', None
firstarg = arginfo.args[0]