event/ast: Use better_exec instead of simple_exec
PATCH 1/1 event/ast: Use better_exec instead of simple_exec
This improves the stack traces dumped by bitbake when for example anonymous python functions fail.
Also default to passing code strings to better_exec to match the behaviour of simple_exec to aid the transition.
Signed-off-by Richard Purdie <[email protected]>
---
bitbake/lib/bb/event.py +1 -1
@@ -175,7 +175,7 @@ def register(name, handler): _handlers[name] = noop return env = {} - bb.utils.simple_exec(code, env) + bb.utils.better_exec(code, env) func = bb.utils.better_eval(name, env) _handlers[name] = func else:
bitbake/lib/bb/parse/ast.py +1 -1
@@ -320,7 +320,7 @@ def finalize(fn, d, variant = None): code = [] for funcname in d.getVar("__BBANONFUNCS") or []: code.append("%s(d)" % funcname) - bb.utils.simple_exec("\n".join(code), {"d": d}) + bb.utils.better_exec("\n".join(code), {"d": d}) bb.data.update_data(d) tasklist = d.getVar('__BBTASKS') or []
bitbake/lib/bb/utils.py +1 -1
@@ -218,7 +218,7 @@ def better_compile(text, file, realfile, mode = "exec"): raise -def better_exec(code, context, text, realfile = "<code>"): +def better_exec(code, context, text = code, realfile = "<code>"): """ Similiar to better_compile, better_exec will print the lines that are responsible for the