Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Proper Identifier Tracking #19

Closed
mitsuhiko opened this Issue Mar 13, 2011 · 3 comments

Comments

Projects
None yet
2 participants
Owner

mitsuhiko commented Mar 13, 2011

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.

Owner

mitsuhiko commented May 3, 2011

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

Contributor

jab commented May 3, 2011

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.

Owner

mitsuhiko commented Jan 7, 2017

This is finally done.

@mitsuhiko mitsuhiko closed this Jan 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment