Skip to content
Myr

Tiny improvement for the loop hack. Implemented it in a way that the

Before adoption: this commit came in with the history the project adopted, so no landing records it.

frame is not modified in the macro body generator. --HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 4ef9234 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:jinja2/compiler.py+1 added-1 removed
653 unmodified lines
654 # real solution would be "nonlocal" all the identifiers that are655 # leaking into a new python frame and might be used both unassigned656 # and assigned.657 if 'loop' in frame.identifiers.declared:658 args.append('l_loop=l_loop')658 args = args + ['l_loop=l_loop']659 self.writeline('def macro(%s):' % ', '.join(args), node)660 self.indent()661 self.buffer(frame)662 self.pull_locals(frame)
845 unmodified lines