[issue40597] generated email message exceeds RFC-mandated limit of 998 characters

Mark Sapiro report at bugs.python.org
Sat May 30 13:38:05 EDT 2020


Mark Sapiro <mark at msapiro.net> added the comment:

With the fix in PR 20038, committed at https://github.com/python/cpython/commit/6f2f475d5a2cd7675dce844f3af436ba919ef92b it is no longer possible to set_content(''). Attempts to do so produce the following
```
  File "/var/MM/3/hk_39/hyperkitty/.tox/py39-django30/lib/python3.9/site-packages/django_mailman3/lib/scrub.py", line 95, in _get_all_attachments
    part.set_content('')
  File "/usr/local/lib/python3.9/email/message.py", line 1171, in set_content
    super().set_content(*args, **kw)
  File "/usr/local/lib/python3.9/email/message.py", line 1101, in set_content
    content_manager.set_content(self, *args, **kw)
  File "/usr/local/lib/python3.9/email/contentmanager.py", line 37, in set_content
    handler(msg, obj, *args, **kw)
  File "/usr/local/lib/python3.9/email/contentmanager.py", line 185, in set_text_content
    cte, payload = _encode_text(string, charset, cte, msg.policy)
  File "/usr/local/lib/python3.9/email/contentmanager.py", line 149, in _encode_text
    if max(len(x) for x in lines) <= policy.max_line_length:
ValueError: max() arg is an empty sequence
```

----------
nosy: +msapiro

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40597>
_______________________________________


More information about the Python-bugs-list mailing list