Skip to contentSkip to conversation

utils: Improve traceback from better_exec internal errors

PATCH New Richard Purdie 1 participant 1 message Dec 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils: Improve traceback from better_exec internal errors

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.

bitbake/lib/bb/utils.py +4 -2
index 31ec2b7..4ed7608 100644
@@ -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')