[PATCH 01 of 10 STABLE] py3: decode payload of notify email

Yuya Nishihara yuya at tcha.org
Fri Oct 25 08:23:50 EDT 2019


On Thu, 24 Oct 2019 17:30:32 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1571927683 -7200
> #      Thu Oct 24 16:34:43 2019 +0200
> # Branch stable
> # Node ID 4e91ce8060e960bd8f9656a1f9b00fdb82199b3c
> # Parent  4565a0afc2891f0bbba8ea9d9df21267d18cf832
> py3: decode payload of notify email
> 
> This fixes one UnicodeEncodeError in test-notify.t:422 when testing the
> notify hook with non-ascii content (there are more later).
> 
> diff --git a/hgext/notify.py b/hgext/notify.py
> --- a/hgext/notify.py
> +++ b/hgext/notify.py
> @@ -401,7 +401,7 @@ class notifier(object):
>              # create fresh mime message from scratch
>              # (multipart templates must take care of this themselves)
>              headers = msg.items()
> -            payload = msg.get_payload()
> +            payload = msg.get_payload(decode=True)

I'm not pretty sure if this is safe on Python 2.


More information about the Mercurial-devel mailing list