Fixed a bug that caused internal errors if names where used as iteration
variable and regular variable *after* the loop if that variable was unused
*before* the loop. (#331)
--HG--
branch : trunk
diff --git a/tests/test_forloop.py b/tests/test_forloop.py
index b7079c8..c5bac48 100644
--- a/tests/test_forloop.py
+++ b/tests/test_forloop.py
@@ -175,3 +175,12 @@
{%- endfor -%}
''')
assert t.render() == '[1][2][3]'
+
+
+def test_scoping_bug(env):
+ t = env.from_string('''
+ {%- for item in foo %}...{{ item }}...{% endfor %}
+ {%- macro item(a) %}...{{ a }}...{% endmacro %}
+ {{- item(2) -}}
+ ''')
+ assert t.render(foo=(1,)) == '...1......2...'