From: Daniel Morrison Date: Sun, 7 Apr 2019 14:55:57 +0000 (-0400) Subject: Fix #48 X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=7406c16e43d1112a3691299ff0913a676c3b9fd2;p=chevron.git Fix #48 Turns out some weird scoping things were happening. The `scopes` variable is being passed throughout by reference. Which is great (yay speed improvements). In theory. Except... All operations must therefore operate on scopes by reference. `scopes = scopes[1:]` used to end a scope updates the reference. This means the parent call to renderer doesn't leave the scope. --- diff --git a/chevron/renderer.py b/chevron/renderer.py index 788e2bb..f0c4032 100644 --- a/chevron/renderer.py +++ b/chevron/renderer.py @@ -194,7 +194,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache', # If we're an end tag if tag == 'end': # Pop out of the latest scope - scopes = scopes[1:] + del scopes[0] # If the current scope is falsy and not the only scope elif not current_scope and len(scopes) != 1: