Mark Sapiro <m...@msapiro.net> added the comment:

This came about because of an actual situation in a Mailman 3 installation. I 
can't say for sure what the actual original message looked like, but it was 
received by Mailman's LMTP server and parsed with email.message_from_bytes(), 
so it clearly wasn't exactly like the message excerpt I posted in the report 
above. However, All I had to go by was the message object from the shunted 
pickle file created as a result of the exception.

The message was processed by Mailman, but when Mailman's handler pipeline 
attempted to save it for the digest, it calls an instance of mailbox.MMDF to 
add the message to the mailbox accumulating messages for the digest, and that 
in turn calls the flatten method of an email.generator.BytesGenerator instance. 
and that's where the exception was thrown.

Perhaps the suggested patch in https://github.com/python/cpython/pull/18056 
doesn't address every possible case, and it can result in a slightly garbled 
message due to replacing 'invalid' characters, but in my case at least, it is 
much preferable to the alternative.

----------

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

Reply via email to