Patchwork [4,of,7] py3: use system string to access email headers

login
register
mail settings
Submitter Yuya Nishihara
Date April 8, 2018, 9:09 a.m.
Message ID <323e34785dacaad98d06.1523178587@mimosa>
Download mbox | patch
Permalink /patch/30560/
State Accepted
Headers show

Comments

Yuya Nishihara - April 8, 2018, 9:09 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1523167380 -32400
#      Sun Apr 08 15:03:00 2018 +0900
# Node ID 323e34785dacaad98d06dd3b15c2370779149e97
# Parent  9e3b46147b952770b7b10d626a745df8f3c1eeb1
py3: use system string to access email headers

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -224,8 +224,8 @@  def extract(ui, fileobj):
     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))