[PATCH 05 of 10 STABLE] mail: catch LookupError in headdecode()

Denis Laxalde denis at laxalde.org
Thu Oct 24 11:30:36 EDT 2019


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1571920284 -7200
#      Thu Oct 24 14:31:24 2019 +0200
# Branch stable
# Node ID d1382260a9c847b4650c95372161541ac82cb56b
# Parent  0e2dd04f18a589180731471cc6a62a10f097bc59
mail: catch LookupError in headdecode()

We already catch this exception in _encode() (called by headencode()).
It gets raised when running test-notify.t with Python 3.

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -459,7 +459,7 @@ def headdecode(s):
             try:
                 uparts.append(part.decode(charset))
                 continue
-            except UnicodeDecodeError:
+            except (UnicodeDecodeError, LookupError):
                 pass
         # On Python 3, decode_header() may return either bytes or unicode
         # depending on whether the header has =?<charset>? or not


More information about the Mercurial-devel mailing list