New submission from Erik Quaeghebeur <pyt...@equaeghe.nospammail.net>:

IĀ got the following error (Python 3.7.8):

Traceback (most recent call last):
  File "/home/equaeghe/.local/bin/html2alternative.py", line 68, in <module>
    replaceable.add_alternative(plain)
  File "/usr/lib/python3.7/email/message.py", line 1153, in add_alternative
    self._add_multipart('alternative', *args, **kw)
  File "/usr/lib/python3.7/email/message.py", line 1144, in _add_multipart
    part.set_content(*args, **kw)
  File "/usr/lib/python3.7/email/message.py", line 1171, in set_content
    super().set_content(*args, **kw)
  File "/usr/lib/python3.7/email/message.py", line 1101, in set_content
    content_manager.set_content(self, *args, **kw)
  File "/usr/lib/python3.7/email/contentmanager.py", line 37, in set_content
    handler(msg, obj, *args, **kw)
  File "/usr/lib/python3.7/email/contentmanager.py", line 185, in 
set_text_content
    cte, payload = _encode_text(string, charset, cte, msg.policy)
  File "/usr/lib/python3.7/email/contentmanager.py", line 154, in _encode_text
    max(len(x) for x in lines) <= policy.max_line_length):
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

This is triggered because it is incorrectly assumed that policy.max_line_length 
cannot be None. This issue is still present in current master:

https://github.com/python/cpython/blob/c3dd7e45cc5d36bbe2295c2840faabb5c75d83e4/Lib/email/contentmanager.py#L149

----------
components: email
messages: 375625
nosy: barry, equaeghe, r.david.murray
priority: normal
severity: normal
status: open
title: policy.max_line_length is incorrectly assumed to never be None
type: behavior
versions: Python 3.10

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

Reply via email to