On Sat, 09 Nov 2019 17:06:40 +0100, Denis Laxalde wrote: > # HG changeset patch > # User Denis Laxalde <de...@laxalde.org> > # Date 1573299914 -3600 > # Sat Nov 09 12:45:14 2019 +0100 > # Node ID 1c7a66bf3315f69036420e2b07b584abacfef881 > # Parent a78a65c33b5aa84cc9c3ae5f7dad636d371f149c > mail: let headencode() return a native string
Queued the first two, thanks. > diff --git a/mercurial/mail.py b/mercurial/mail.py > --- a/mercurial/mail.py > +++ b/mercurial/mail.py > @@ -365,13 +365,13 @@ def headencode(ui, s, charsets=None, dis > if not display: > # split into words? > s, cs = _encode(ui, s, charsets) > - return encoding.strtolocal(email.header.Header(s, cs).encode()) > - return s > + return email.header.Header(s, cs).encode() > + return encoding.strfromlocal(s) I think we should add some type comments to help readers to see which string type is returned/accepted/used. Mixing bytes and unicode is a nightmare. I'm not an expert, but maybe we can annotate both functions and variables with "# type: <type expr>" comment? https://google.github.io/pytype/user_guide.html#variable-annotations Augie, do you have any idea? _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel