diff mercurial/templatekw.py @ 33017:c31d45623304

py3: convert kwargs' keys' to str using pycompat.strkwargs() On Python 3, we must have keys of keyword arguments as str.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 22 Jun 2017 03:16:16 +0530
parents f66be4caeaab
children de8e3681c402
line wrap: on
line diff
--- a/mercurial/templatekw.py	Thu Jun 22 03:10:24 2017 +0530
+++ b/mercurial/templatekw.py	Thu Jun 22 03:16:16 2017 +0530
@@ -119,23 +119,24 @@
     expand 'end_foos'.
     '''
     templ = mapping['templ']
+    strmapping = pycompat.strkwargs(mapping)
     if not plural:
         plural = name + 's'
     if not values:
         noname = 'no_' + plural
         if noname in templ:
-            yield templ(noname, **mapping)
+            yield templ(noname, **strmapping)
         return
     if name not in templ:
         if isinstance(values[0], bytes):
             yield separator.join(values)
         else:
             for v in values:
-                yield dict(v, **mapping)
+                yield dict(v, **strmapping)
         return
     startname = 'start_' + plural
     if startname in templ:
-        yield templ(startname, **mapping)
+        yield templ(startname, **strmapping)
     vmapping = mapping.copy()
     def one(v, tag=name):
         try:
@@ -146,7 +147,7 @@
                     vmapping[a] = b
             except ValueError:
                 vmapping[name] = v
-        return templ(tag, **vmapping)
+        return templ(tag, **pycompat.strkwargs(vmapping))
     lastname = 'last_' + name
     if lastname in templ:
         last = values.pop()
@@ -158,7 +159,7 @@
         yield one(last, tag=lastname)
     endname = 'end_' + plural
     if endname in templ:
-        yield templ(endname, **mapping)
+        yield templ(endname, **strmapping)
 
 def _formatrevnode(ctx):
     """Format changeset as '{rev}:{node|formatnode}', which is the default