Message326364
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. |
|
Date |
User |
Action |
Args |
2018-09-25 15:36:08 | silane | set | recipients:
+ silane, barry, r.david.murray |
2018-09-25 15:36:08 | silane | set | messageid: <1537889768.86.0.545547206417.issue34800@psf.upfronthosting.co.za> |
2018-09-25 15:36:08 | silane | link | issue34800 messages |
2018-09-25 15:36:08 | silane | create | |
|