-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-41402: Fix email ContentManager calling .encode() on bytes #21631
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
EmailMessage
viaset_content()
, the functionemail.contentmanager.set_bytes_content()
is called. This function fails when choosing the7bit
transfer encoding because of a call todata.decode('ascii')
. Sincebytes
does 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 is7bit
and at the same time remove an inefficiency sinceset_payload()
would have decoded the data anyway.https://bugs.python.org/issue41402