Patchwork [1,of,6] mail: fix a bad return type in _encode()

login
register
mail settings
Submitter Denis Laxalde
Date Nov. 13, 2019, 9:59 p.m.
Message ID <a57f3ab9661af30fd20d.1573682394@marimba>
Download mbox | patch
Permalink /patch/43161/
State Accepted
Headers show

Comments

Denis Laxalde - Nov. 13, 2019, 9:59 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1573575136 -3600
#      Tue Nov 12 17:12:16 2019 +0100
# Node ID a57f3ab9661af30fd20d6a69d872448afa4612bd
# Parent  c207c46a86b92ad7be05de2bf85bb36757e8ae3a
mail: fix a bad return type in _encode()

This particular instruction returned only a string and omitted the
charset value.

Patch

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -336,7 +336,7 @@  def _encode(ui, s, charsets):
                 ui.warn(_(b'ignoring invalid sendcharset: %s\n') % ocs)
         else:
             # Everything failed, ascii-armor what we've got and send it.
-            return s.encode('ascii', 'backslashreplace')
+            return s.encode('ascii', 'backslashreplace'), b'us-ascii'
     # We have a bytes of unknown encoding. We'll try and guess a valid
     # encoding, falling back to pretending we had ascii even though we
     # know that's wrong.