Skip to content

Commit 8c59899

Browse files
Fix CI on Android and iOS
1 parent 7592af8 commit 8c59899

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Lib/email/_header_value_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,10 @@ def params(self):
796796
value = urllib.parse.unquote(value, encoding='latin-1')
797797
else:
798798
try:
799+
# Explicitly look up the codec for warning generation, see gh-140030
800+
# Can be removed in 3.17
801+
import codecs
802+
codecs.lookup(charset)
799803
value = value.decode(charset, 'surrogateescape')
800804
except (LookupError, UnicodeEncodeError):
801805
# XXX: there should really be a custom defect for

Lib/email/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ def collapse_rfc2231_value(value, errors='replace',
460460
charset = fallback_charset
461461
rawbytes = bytes(text, 'raw-unicode-escape')
462462
try:
463+
# Explicitly look up the codec for warning generation, see gh-140030
464+
# Can be removed in 3.17
465+
import codecs
466+
codecs.lookup(charset)
463467
return str(rawbytes, charset, errors)
464468
except LookupError:
465469
# charset is not a known codec.

0 commit comments

Comments
 (0)