changeset 38352:e9cb13c54d63

templater: make it clearer that parsing doesn't cause recursion Only compileexp() may recurse into _load().
author Yuya Nishihara <yuya@tcha.org>
date Thu, 03 May 2018 11:09:27 +0900
parents de089e3eb328
children 48289eafb37d
files mercurial/templater.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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]