>  def _addressencode(ui, name, addr, charsets=None):
>      name = headencode(ui, name, charsets)
>      try:
> -        acc, dom = addr.split('@')
> +        acc, dom = addr.split(r'@')

I think `addr` here should be a byte string since `dom` is decoded to unicode,
and `addr` is embedded in abort message.

>          acc = acc.encode('ascii')
>          dom = dom.decode(encoding.encoding).encode('idna')
>          addr = '%s@%s' % (acc, dom)
> @@ -311,27 +311,31 @@
>              addr = addr.encode('ascii')
>          except UnicodeDecodeError:
>              raise error.Abort(_('invalid local address: %s') % addr)
> -    return email.utils.formataddr((name, addr))
> +    return pycompat.bytesurl(
> +        email.utils.formataddr((name, encoding.strfromlocal(addr))))

>      result = []
> -    for name, addr in email.utils.getaddresses(addrs):
> +    for name, addr in email.utils.getaddresses(
> +            [encoding.strfromlocal(a) for a in addrs]):
>          if name or addr:
>              result.append(_addressencode(ui, name, addr, charsets))
> -    return result
> +    return [pycompat.bytesurl(r) for r in result]

_addressencode() retunrs bytes.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to