py3: use system string to access email headers
authorYuya Nishihara <yuya@tcha.org>
Sun, 08 Apr 2018 15:03:00 +0900
changeset 37468 ef661ce45cdb
parent 37467 9bf65d1b43a6
child 37469 7edf68862fe3
py3: use system string to access email headers
mercurial/patch.py
--- a/mercurial/patch.py	Sun Apr 08 14:59:12 2018 +0900
+++ b/mercurial/patch.py	Sun Apr 08 15:03:00 2018 +0900
@@ -224,8 +224,8 @@
     try:
         msg = pycompat.emailparser().parse(fileobj)
 
-        subject = msg['Subject'] and mail.headdecode(msg['Subject'])
-        data['user'] = msg['From'] and mail.headdecode(msg['From'])
+        subject = msg[r'Subject'] and mail.headdecode(msg[r'Subject'])
+        data['user'] = msg[r'From'] and mail.headdecode(msg[r'From'])
         if not subject and not data['user']:
             # Not an email, restore parsed headers if any
             subject = '\n'.join(': '.join(map(encoding.strtolocal, h))