summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-01-26 00:39:19 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-01-26 00:39:19 (GMT)
commit3a7ee3ab5a251f440e8094b649f7592cf342c2d2 (patch)
tree1b2077d00f1028c9187dbc74840616ac83a12f65 /Lib/email
parent0c4cc559cbef20a917367415af011c29ce6d334e (diff)
downloadcpython-3a7ee3ab5a251f440e8094b649f7592cf342c2d2.zip
cpython-3a7ee3ab5a251f440e8094b649f7592cf342c2d2.tar.gz
cpython-3a7ee3ab5a251f440e8094b649f7592cf342c2d2.tar.bz2
Fix BytesGenerator._handle_text() if the message has no payload (None)
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/generator.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index 9d33f1c..e382b85 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -377,8 +377,11 @@ class BytesGenerator(Generator):
def _handle_text(self, msg):
# If the string has surrogates the original source was bytes, so
# just write it back out.
- if _has_surrogates(msg._payload):
- self.write(msg._payload)
+ payload = msg.get_payload()
+ if payload is None:
+ return
+ if _has_surrogates(payload):
+ self.write(payload)
else:
super(BytesGenerator,self)._handle_text(msg)