Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Proper Identifier Tracking #19

mitsuhiko opened this Issue · 2 comments

2 participants


Currently the identifier tracking is very crude and is based on just prefixing variables. The idea would be to keep some unique variable rewriting into unique identifiers that can be reversed as well.

This should make it unnecessary to use locals() all over the code and fix some problems with identifiers over function boundaries.


How do you know you are affected by this issue? You get something along the lines of "Unbound variable l_SOMETHING" found.

jab commented

From #pocoo just now:

magicbronson: hey mitsuhiko et al., trying to render a Jinja template in a Flask app and getting a very mysterious message: "global name 'l_config' is not defined"
magicbronson: l_config appears nowhere in my code or libraries'
mitsuhiko: magicbronson: that's the scoping bug that i will fix over this summer 
mitsuhiko: {% macro foo() %}{{ config }}{% for config in something_else %}{{config}}{% endfor %}{% endmacro %}
mitsuhiko: something like this triggers the bug currently
mitsuhiko: magicbronson: rename the variable inside of the macro to something else
mitsuhiko: {% set cfg = config %}
mitsuhiko: outside the macro
mitsuhiko: or something

Armin's suggestion worked around the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.