mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
SF patch# 1757839 by Alexandre Vassalotti -- make test_mailbox and
test_old_mailbox pass.
This commit is contained in:
parent
bf4806bac5
commit
d4eda825c7
4 changed files with 18 additions and 15 deletions
|
@ -253,7 +253,7 @@ class Header:
|
|||
# We need to test that the string can be converted to unicode and
|
||||
# back to a byte string, given the input and output codecs of the
|
||||
# charset.
|
||||
if isinstance(s, str):
|
||||
if isinstance(s, bytes):
|
||||
# Possibly raise UnicodeError if the byte string can't be
|
||||
# converted to a unicode with the input codec of the charset.
|
||||
incodec = charset.input_codec or 'us-ascii'
|
||||
|
@ -263,7 +263,7 @@ class Header:
|
|||
# than the iput coded. Still, use the original byte string.
|
||||
outcodec = charset.output_codec or 'us-ascii'
|
||||
ustr.encode(outcodec, errors)
|
||||
elif isinstance(s, str):
|
||||
elif isinstance(s, bytes):
|
||||
# Now we have to be sure the unicode string can be converted
|
||||
# to a byte string with a reasonable output codec. We want to
|
||||
# use the byte string in the chunk.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue