hgext/patchbomb.py
changeset 38776 65ed2fcb9032
parent 38472 d17d1ee1d602
child 39022 b95538a21613
--- a/hgext/patchbomb.py	Mon Jul 30 14:37:36 2018 -0700
+++ b/hgext/patchbomb.py	Mon Jul 16 14:15:29 2018 -0400
@@ -780,6 +780,16 @@
             m['Bcc'] = ', '.join(bcc)
         if replyto:
             m['Reply-To'] = ', '.join(replyto)
+        # Fix up all headers to be native strings.
+        # TODO(durin42): this should probably be cleaned up above in the future.
+        if pycompat.ispy3:
+            for hdr, val in list(m.items()):
+                if isinstance(hdr, bytes):
+                    del m[hdr]
+                    hdr = pycompat.strurl(hdr)
+                if isinstance(val, bytes):
+                    val = pycompat.strurl(val)
+                m[hdr] = val
         if opts.get('test'):
             ui.status(_('displaying '), subj, ' ...\n')
             ui.pager('email')