Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper Identifier Tracking #19

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

Proper Identifier Tracking #19

mitsuhiko opened this issue Mar 13, 2011 · 3 comments

Comments

@mitsuhiko
Copy link
Contributor

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.

@mitsuhiko
Copy link
Contributor Author

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

@jab
Copy link
Member

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.

@mitsuhiko
Copy link
Contributor Author

This is finally done.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants