[issue11401] email.header error during .flatten()

Steffen Daode Nurpmeso report at bugs.python.org
Mon Mar 7 15:36:23 CET 2011


Steffen Daode Nurpmeso <sdaoden at googlemail.com> added the comment:

David, it seems my patch http://bugs.python.org/file20675/email_header.patch 
is a real requirement for EMAIL 5.1 code.

This is because BytesGenerator._write_headers() creates a Header 
instance in 'else:' (the other branches are not entered at all for 
the test mail), passing 'v' as the 's=' arg of Header ctor. 
It follows that Header._chunks[] is never the empty list. 
'v' however may be the empty string for header fields like 
'X-Status:', 'X-Keywords:' and maybe more, resulting in 
string.splitlines() trying to break up the empty string.

I don't understand why i could pass thousands of mails, including 
the test mail, dozens of times through my thing without showing 
this up?  Does the mailbox.mbox message subclass adjust such things? 
Bye.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11401>
_______________________________________


More information about the Python-bugs-list mailing list