Actualmente, el seguimiento de identificadores es muy burdo y se basa solo en prefijar variables. La idea sería mantener alguna variable única reescrita en identificadores únicos que también se pueden revertir.
Esto debería hacer innecesario el uso de locals () en todo el código y solucionar algunos problemas con los identificadores sobre los límites de las funciones.
¿Cómo sabe que se ve afectado por este problema? Obtiene algo parecido a "Variable independiente l_SOMETHING" encontrada.
De #pocoo hace un momento:
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
La sugerencia de Armin solucionó el problema.
Esto finalmente está hecho.
Comentario más útil
Esto finalmente está hecho.