summaryrefslogtreecommitdiffstats
path: root/Lib/email/generator.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-03-14 18:24:22 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-03-14 18:24:22 (GMT)
commit8d8f11049265f4e53b2d97f5caa73c4ca0ee7875 (patch)
tree9e5f681a88bd3b4c905f424a87ea03406a05f38a /Lib/email/generator.py
parent9d8c18665004755d87ba891a822265199a160609 (diff)
parent9fd170e2d053bd86592b8728bdd00cf2d2a06d0b (diff)
downloadcpython-8d8f11049265f4e53b2d97f5caa73c4ca0ee7875.zip
cpython-8d8f11049265f4e53b2d97f5caa73c4ca0ee7875.tar.gz
cpython-8d8f11049265f4e53b2d97f5caa73c4ca0ee7875.tar.bz2
#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.
Diffstat (limited to 'Lib/email/generator.py')
-rw-r--r--Lib/email/generator.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index d8b8fa9..edba13f 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -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