Mark Sapiro added the comment:

One additional observation. The original message contained no 
Content-Transfer-Encoding header even though the message body was raw koi8-r 
characters. Adding

Content-Transfer-Encoding: 8bit

to the message headers avoids the issue, but that is not a practical solution 
as the message was Russian spam received by a Mailman list and the resultant 
KeyError caused problems in Mailman.

We can work on defending against this in Mailman, but I suggest that the 
munge_cte code in generator._write() avoid the documented possible KeyError 
raised by replace_header() by using __delitem__() and __setitem__() instead as 
in the attached generator.patch.

----------
keywords: +patch
Added file: http://bugs.python.org/file43394/generator.patch

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

Reply via email to