diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-15 17:42:40 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-15 17:48:18 +0000 |
commit | 1d710ed484f68fca0789022dde7ba877b9a894f5 (patch) | |
tree | c740f9642b5d38e656d43fd10ae1cf675242c0dc | |
parent | 1ff860960919ff6f8097138bc68de85bcb5f88b0 (diff) | |
download | bitbake-1d710ed484f68fca0789022dde7ba877b9a894f5.tar.gz |
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index c5ff903ce..e564bb6ff 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -327,8 +327,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') |