Mercurial > public > mercurial-scm > hg
comparison mercurial/mail.py @ 43324:866bd2cf764b stable
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.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Thu, 24 Oct 2019 14:31:24 +0200 |
parents | 9145abd8b96d |
children | 7d4f2e4899c5 |
comparison
equal
deleted
inserted
replaced
43323:84c15836a2d7 | 43324:866bd2cf764b |
---|---|
456 for part, charset in email.header.decode_header(s): | 456 for part, charset in email.header.decode_header(s): |
457 if charset is not None: | 457 if charset is not None: |
458 try: | 458 try: |
459 uparts.append(part.decode(charset)) | 459 uparts.append(part.decode(charset)) |
460 continue | 460 continue |
461 except UnicodeDecodeError: | 461 except (UnicodeDecodeError, LookupError): |
462 pass | 462 pass |
463 # On Python 3, decode_header() may return either bytes or unicode | 463 # On Python 3, decode_header() may return either bytes or unicode |
464 # depending on whether the header has =?<charset>? or not | 464 # depending on whether the header has =?<charset>? or not |
465 if isinstance(part, type(u'')): | 465 if isinstance(part, type(u'')): |
466 uparts.append(part) | 466 uparts.append(part) |