templater: make it clearer that parsing doesn't cause recursion
authorYuya Nishihara <yuya@tcha.org>
Thu, 03 May 2018 11:09:27 +0900
changeset 38352 e9cb13c54d63
parent 38351 de089e3eb328
child 38353 48289eafb37d
templater: make it clearer that parsing doesn't cause recursion Only compileexp() may recurse into _load().
mercurial/templater.py
--- a/mercurial/templater.py	Thu May 03 10:53:29 2018 +0900
+++ b/mercurial/templater.py	Thu May 03 11:09:27 2018 +0900
@@ -665,12 +665,12 @@
     def _load(self, t):
         '''load, parse, and cache a template'''
         if t not in self._cache:
+            x = parse(self._loader(t))
+            if self._aliasmap:
+                x = _aliasrules.expand(self._aliasmap, x)
             # put poison to cut recursion while compiling 't'
             self._cache[t] = (_runrecursivesymbol, t)
             try:
-                x = parse(self._loader(t))
-                if self._aliasmap:
-                    x = _aliasrules.expand(self._aliasmap, x)
                 self._cache[t] = compileexp(x, self, methods)
             except: # re-raises
                 del self._cache[t]