[bitbake-devel] [PATCH] utils: Improve traceback from better_exec internal errors

Richard Purdie richard.purdie at linuxfoundation.org
Tue Dec 15 17:42:40 UTC 2015


If you break the internals of better_exec(), you get a very weird 
error about tb_next not being a method of None. Fix this by checking 
we can step back a trace level.

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 31ec2b7..4ed7608 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -323,8 +323,10 @@ def _print_exception(t, value, tb, realfile, text, context):
         exception = traceback.format_exception_only(t, value)
         error.append('Error executing a python function in %s:\n' % realfile)
 
-        # Strip 'us' from the stack (better_exec call)
-        tb = tb.tb_next
+        # Strip 'us' from the stack (better_exec call) unless that was where the 
+        # error came from
+        if tb.tb_next is not None:
+            tb = tb.tb_next
 
         textarray = text.split('\n')





More information about the bitbake-devel mailing list