mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
#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:
commit
8d8f110492
3 changed files with 30 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue