mercurial/templater.py
changeset 34723 b13c95919ff5
parent 34715 f17a0e18c47e
child 34808 e87e62b7fc0b
--- a/mercurial/templater.py	Sat Oct 14 11:20:31 2017 -0400
+++ b/mercurial/templater.py	Sat Oct 14 11:30:17 2017 -0400
@@ -1240,6 +1240,11 @@
     thing = templatekw.unwraphybrid(thing)
     if isinstance(thing, bytes):
         yield thing
+    elif isinstance(thing, str):
+        # We can only hit this on Python 3, and it's here to guard
+        # against infinite recursion.
+        raise error.ProgrammingError('Mercurial IO including templates is done'
+                                     ' with bytes, not strings')
     elif thing is None:
         pass
     elif not util.safehasattr(thing, '__iter__'):