New submission from silane <michiwats...@gmail.com>:

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.

----------
components: email
messages: 326364
nosy: barry, r.david.murray, silane
priority: normal
severity: normal
status: open
title: email.contentmanager raises error when policy.max_line_length==None or 0
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to