mercurial/templateutil.py
changeset 38241 ad06a4264daf
parent 38240 c2456a7726c1
child 38242 12b6ee9e88f3
--- a/mercurial/templateutil.py	Wed Mar 21 01:18:29 2018 +0900
+++ b/mercurial/templateutil.py	Sat Apr 21 17:43:16 2018 +0900
@@ -666,14 +666,16 @@
     if util.safehasattr(d, 'tomap'):
         lm = context.overlaymap(mapping, d.tomap())
         return runsymbol(context, lm, memb)
-    if util.safehasattr(d, 'get'):
-        return getdictitem(d, memb)
-
-    sym = findsymbolicname(darg)
-    if sym:
-        raise error.ParseError(_("keyword '%s' has no member") % sym)
-    else:
-        raise error.ParseError(_("%r has no member") % pycompat.bytestr(d))
+    try:
+        if util.safehasattr(d, 'get'):
+            return getdictitem(d, memb)
+        raise error.ParseError
+    except error.ParseError:
+        sym = findsymbolicname(darg)
+        if sym:
+            raise error.ParseError(_("keyword '%s' has no member") % sym)
+        else:
+            raise error.ParseError(_("%r has no member") % pycompat.bytestr(d))
 
 def runnegate(context, mapping, data):
     data = evalinteger(context, mapping, data,