diff -r a83c9c79b722 -r 0e6a7ce81dde mercurial/mail.py --- a/mercurial/mail.py Thu Oct 10 10:03:01 2019 +0200 +++ b/mercurial/mail.py Thu Oct 10 10:48:57 2019 +0200 @@ -9,6 +9,7 @@ import email import email.charset +import email.generator import email.header import email.message import email.parser @@ -420,6 +421,8 @@ if pycompat.ispy3: + Generator = email.generator.BytesGenerator + def parse(fp): ep = email.parser.Parser() # disable the "universal newlines" mode, which isn't binary safe. @@ -436,6 +439,8 @@ else: + Generator = email.generator.Generator + def parse(fp): ep = email.parser.Parser() return ep.parse(fp)