D4233: mail: be more cautious about bytes vs str for py3 compat
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Thu Aug 9 23:30:49 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG952bf3c948f0: mail: be more cautious about bytes vs str for py3 compat (authored by durin42, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4233?vs=10227&id=10265
REVISION DETAIL
https://phab.mercurial-scm.org/D4233
AFFECTED FILES
mercurial/mail.py
CHANGE DETAILS
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -312,7 +312,9 @@
try:
acc, dom = addr.split(r'@')
acc = acc.encode('ascii')
- dom = dom.decode(encoding.encoding).encode('idna')
+ if isinstance(dom, bytes):
+ dom = dom.decode(encoding.encoding)
+ dom = dom.encode('idna')
addr = '%s@%s' % (acc, dom)
except UnicodeDecodeError:
raise error.Abort(_('invalid email address: %s') % addr)
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list