diff options
author | R. David Murray <rdmurray@bitdance.com> | 2011-01-26 21:21:32 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2011-01-26 21:21:32 (GMT) |
commit | 7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0 (patch) | |
tree | 73992b4a0b679dcc803f4136056c60980fe3dd91 /Lib/email/generator.py | |
parent | a63a312a3f5a4f3b76617831e56ac9d295929fa0 (diff) | |
download | cpython-7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0.zip cpython-7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0.tar.gz cpython-7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0.tar.bz2 |
#11019: Make BytesGenerator handle Message with None body.
Bug discovery and initial patch by Victor Stinner.
Diffstat (limited to 'Lib/email/generator.py')
-rw-r--r-- | Lib/email/generator.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py index 9d33f1c..531fa9a 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: |