mercurial/templatekw.py
changeset 36110 230489fc0b41
parent 35894 6289482f6ab5
child 36247 48a6b1a22ccf
--- a/mercurial/templatekw.py	Sun Feb 11 16:08:11 2018 -0800
+++ b/mercurial/templatekw.py	Sun Feb 11 16:16:43 2018 -0800
@@ -192,11 +192,15 @@
     def one(v, tag=name):
         try:
             vmapping.update(v)
-        except (AttributeError, ValueError):
+        # Python 2 raises ValueError if the type of v is wrong. Python
+        # 3 raises TypeError.
+        except (AttributeError, TypeError, ValueError):
             try:
+                # Python 2 raises ValueError trying to destructure an e.g.
+                # bytes. Python 3 raises TypeError.
                 for a, b in v:
                     vmapping[a] = b
-            except ValueError:
+            except (TypeError, ValueError):
                 vmapping[name] = v
         return templ(tag, **pycompat.strkwargs(vmapping))
     lastname = 'last_' + name