#14062: fix BytesParser handling of Header objects

This is a different fix than the 3.2 fix, but the new tests are the same.

This also affected smtplib.SMTP.send_message, which calls BytesParser.
This commit is contained in:
R David Murray 2012-03-14 14:24:22 -04:00
commit 8d8f110492
3 changed files with 30 additions and 0 deletions

View file

@ -386,6 +386,9 @@ class BytesGenerator(Generator):
h = Header(v, charset=_charset.UNKNOWN8BIT, header_name=h)
else:
h = Header(v, header_name=h)
else:
# Assume it is a Header-like object.
h = v
self.write(h.encode(linesep=self._NL,
maxlinelen=self._maxheaderlen)+self._NL)
# A blank line always separates headers from body