This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author silane
Recipients barry, r.david.murray, silane
Date 2018-09-25.15:36:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537889768.86.0.545547206417.issue34800@psf.upfronthosting.co.za>
In-reply-to
Content
The document of the email.policy.Policy says max_line_length=0 or None indicates that no line wrapping should be done at all.
But email.contentmanager doesn't handle this properly and raises error when calling set_content() with bytes or non-ascii str.


---Code to reproduce the bug---

from email.message import EmailMessage
from email.policy import default
msg=EmailMessage(default.clone(max_line_length=None)) # or max_line_length=0

msg.set_content('あ') # raise error
# or
msg.set_content(b'a',maintype='application',subtype='octet-stream') # raise error

---


This bug is caused by contentmanager._encode_text() and contentmanager.set_bytes_content().
These don't assume policy.max_line_length to be None or 0.

I tested this on python3.7 3.6 3.5, but probably 3.4 has the same bug.
History
Date User Action Args
2018-09-25 15:36:08silanesetrecipients: + silane, barry, r.david.murray
2018-09-25 15:36:08silanesetmessageid: <1537889768.86.0.545547206417.issue34800@psf.upfronthosting.co.za>
2018-09-25 15:36:08silanelinkissue34800 messages
2018-09-25 15:36:08silanecreate