From 7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0 Mon Sep 17 00:00:00 2001 From: "R. David Murray" Date: Wed, 26 Jan 2011 21:21:32 +0000 Subject: #11019: Make BytesGenerator handle Message with None body. Bug discovery and initial patch by Victor Stinner. --- Lib/email/generator.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/email/generator.py') diff --git a/Lib/email/generator.py b/Lib/email/generator.py index 9d33f1cb87..531fa9a7a4 100644 --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -377,6 +377,8 @@ 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 msg._payload is None: + return if _has_surrogates(msg._payload): self.write(msg._payload) else: -- cgit v1.2.1