with statement in call causes UnboundLocalError #118

Closed
dplepage opened this Issue Apr 23, 2012 · 2 comments

Projects

None yet

3 participants

@dplepage

I get UnboundLocalError: local variable 'l_x' referenced before assignment whenever I shadow a global via a with block inside a call:

{% set x = 1 %}
{% call foo() %}
    {% with x = 2 %}
    {% endwith %}
{% endcall %}

If I remove the first line, the problem goes away.

I'm using Jinja 2.6 and Python 2.6.7.

@hivre
hivre commented Mar 1, 2015

most likely a duplicate of #278

@mitsuhiko
Member

Fixed by #637

@mitsuhiko mitsuhiko closed this Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment