summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2018-12-12 15:12:47 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2018-12-12 15:16:32 +0000
commit9e190ab1bb954caf19645a4e794df2a50087c249 (patch)
tree49dd7d8c47d0b87ec4b798d7b3c72ee592f937d6
parenta5a53ddd243f0da0c485d539591d8a11e5bd5262 (diff)
downloadbuildstream-bschubert/fix-unbound-variable-exception.tar.gz
element.py: fix unbounded variable in nested python exceptionbschubert/fix-unbound-variable-exception
As per https://docs.python.org/3.7/reference/compound_stmts.html#except variables used in the "except" clause are erased at the end of the block. We had a conflict with a nested exception using the same variable as before. This renames the nested variable to avoid the clash
-rw-r--r--buildstream/element.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index ed279458c..918323a2f 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1612,9 +1612,9 @@ class Element(Plugin):
sandbox_vpath = sandbox_vroot.descend(path_components)
try:
sandbox_vpath.import_files(workspace.get_absolute_path())
- except UtilError as e:
+ except UtilError as e2:
self.warn("Failed to preserve workspace state for failed build sysroot: {}"
- .format(e))
+ .format(e2))
self.__set_build_result(success=False, description=str(e), detail=e.detail)
self._cache_artifact(rootdir, sandbox, e.collect)