# HG changeset patch # User Yuya Nishihara # Date 1525313367 -32400 # Node ID e9cb13c54d633a2a0151e6c079be0726c6323b33 # Parent de089e3eb3288f33947fa8341d2854e41491508b templater: make it clearer that parsing doesn't cause recursion Only compileexp() may recurse into _load(). diff -r de089e3eb328 -r e9cb13c54d63 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]