# HG changeset patch # User Gregory Szorc # Date 2018-02-12 02:50:24 # Node ID 6ea7f1c10c8160da6e31e30c9a024feab4980e15 # Parent 9e47bfbeb7230317f9710768769779cbaadbb60c py3: cast character set to bytes The returned value from this function is eventually fed into email.charset.Charset.__init__. However, the standard library appears to handle both string types in Python 2 and 3. So there shouldn't be any problem returning a bytes here. Differential Revision: https://phab.mercurial-scm.org/D2167 diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -187,7 +187,7 @@ def validateconfig(ui): def codec2iana(cs): '''''' - cs = email.charset.Charset(cs).input_charset.lower() + cs = pycompat.sysbytes(email.charset.Charset(cs).input_charset.lower()) # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1" if cs.startswith("iso") and not cs.startswith("iso-"):