aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--factory/containers.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/factory/containers.py b/factory/containers.py
index 0ae354b..ec33ca1 100644
--- a/factory/containers.py
+++ b/factory/containers.py
@@ -102,8 +102,10 @@ class LazyStub(object):
val = self.__attrs[name]
if isinstance(val, LazyValue):
self.__pending.append(name)
- val = val.evaluate(self, self.__containers)
- last = self.__pending.pop()
+ try:
+ val = val.evaluate(self, self.__containers)
+ finally:
+ last = self.__pending.pop()
assert name == last
self.__values[name] = val
return val