Bradley Laney <bradley.la...@gmail.com> added the comment:

Hey Sven,

New here, decided to try a bit at an issue. 

According to the email.message docs, "the payload is either a string or bytes 
object, in the case of simple message objects, or a list of EmailMessage 
objects, for MIME container documents such as multipart/* and message/rfc822 
message objects."

Like you said, this error happens if the email.message.EmailMessage object is 
bad, i.e. the payload is a string or bytes but the content-type is marked as 
multipart/*. After reading online, it seems like an error is necessary.

I've proposed a small change in a pull request to make this situation raise a 
more useful error. It doesn't blow up any earlier but it at least says 
something more useful. 

The function could return instead of throwing an error, just providing an empty 
iterator, but that seems even less useful.

I fixed it on master (3.8 dev or whatever).

Best,
Brad

----------
nosy: +Bradley Laney
versions: +Python 3.8 -Python 3.5

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

Reply via email to