This revision was automatically updated to reflect the committed changes.
Closed by commit rHG230489fc0b41: py3: catch TypeError during template 
operations (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2156?vs=5457&id=5580

REVISION DETAIL
  https://phab.mercurial-scm.org/D2156

AFFECTED FILES
  mercurial/templatekw.py

CHANGE DETAILS

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -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



To: indygreg, #hg-reviewers, pulkit, durin42
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to