Fixed a bug with the loop context of a for loop if the iterator passed has a volatile `__len__` like the listreverseiterator. `else` in inline if-expressions is optional now.
--HG--
branch : trunk
diff --git a/jinja2/nodes.py b/jinja2/nodes.py
index 56daae4..effa6d4 100644
--- a/jinja2/nodes.py
+++ b/jinja2/nodes.py
@@ -499,6 +499,11 @@
def as_const(self):
if self.test.as_const():
return self.expr1.as_const()
+
+ # if we evaluate to an undefined object, we better do that at runtime
+ if self.expr2 is None:
+ raise Impossible()
+
return self.expr2.as_const()