From b69e97de53eb172ed730993e3b755debaa26f30d Mon Sep 17 00:00:00 2001 From: Chris Laplante Date: Tue, 8 Sep 2020 19:31:50 -0400 Subject: utils: fix UnboundLocalError when _print_exception raises PEP 3110 changed how exceptions work. 'e' is unbound after the 'except' clause. See: https://www.python.org/dev/peps/pep-3110/#semantic-changes Signed-off-by: Chris Laplante Signed-off-by: Richard Purdie --- lib/bb/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bb/utils.py b/lib/bb/utils.py index d6afa2154..0b79f92e2 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -402,8 +402,8 @@ def better_exec(code, context, text = None, realfile = "", pythonexception (t, value, tb) = sys.exc_info() try: _print_exception(t, value, tb, realfile, text, context) - except Exception as e: - logger.error("Exception handler error: %s" % str(e)) + except Exception as e2: + logger.error("Exception handler error: %s" % str(e2)) e = bb.BBHandledException(e) raise e -- cgit 1.2.3-korg