fixes issue with code generator that causes unbound variables
to be generated if set was used in if-blocks.

--HG--
branch : trunk
diff --git a/tests/test_old_bugs.py b/tests/test_old_bugs.py
index 92fb43a..bea07dc 100644
--- a/tests/test_old_bugs.py
+++ b/tests/test_old_bugs.py
@@ -69,3 +69,9 @@
     tmpl = env.from_string('{% for i in (1, 2) %}{{ i }}{% endfor %}'
                            '{% macro i() %}3{% endmacro %}{{ i() }}')
     assert tmpl.render() == '123'
+
+
+def test_partial_conditional_assignments():
+    tmpl = env.from_string('{% if b %}{% set a = 42 %}{% endif %}{{ a }}')
+    assert tmpl.render(a=23) == '23'
+    assert tmpl.render(b=True) == '42'