bpo-41402: Fix email ContentManager calling .encode() on bytes#21631
bpo-41402: Fix email ContentManager calling .encode() on bytes#21631ambv merged 3 commits intopython:mainfrom joreiff:fix-email-bytes-7bit
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). Recognized GitHub usernameWe couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames: This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
Misc/NEWS.d/next/Library/2020-07-26-18-17-30.bpo-41402.YRkVkp.rst
Outdated
Show resolved
Hide resolved
|
Is there anything else I need to do before this PR can be merged? |
|
@bitdancer How does merging work? Do I need to do something regarding the Python 3.8 and 3.9 backports? |
…nGH-21631) (cherry picked from commit b33186b) Co-authored-by: Johannes Reiff <mail@jreiff.de>
|
GH-27686 is a backport of this pull request to the 3.10 branch. |
…nGH-21631) (cherry picked from commit b33186b) Co-authored-by: Johannes Reiff <mail@jreiff.de>
|
GH-27687 is a backport of this pull request to the 3.9 branch. |
|
Perfect, thank you! |
) (cherry picked from commit b33186b) Co-authored-by: Johannes Reiff <mail@jreiff.de>
If assigning binary content to an
EmailMessageviaset_content(), the functionemail.contentmanager.set_bytes_content()is called. This function fails when choosing the7bittransfer encoding because of a call todata.decode('ascii'). Sincebytesdoes not have a method.decode(), an exception is raised.By changing
data.decode('ascii')todata = data.encode('ascii'), we make sure that the input data really is7bitand at the same time remove an inefficiency sinceset_payload()would have decoded the data anyway.https://bugs.python.org/issue41402