[Python-checkins] r88197 - python/branches/py3k/Lib/email/generator.py

victor.stinner python-checkins at python.org
Wed Jan 26 01:39:19 CET 2011


Author: victor.stinner
Date: Wed Jan 26 01:39:19 2011
New Revision: 88197

Log:
Fix BytesGenerator._handle_text() if the message has no payload (None)

Modified:
   python/branches/py3k/Lib/email/generator.py

Modified: python/branches/py3k/Lib/email/generator.py
==============================================================================
--- python/branches/py3k/Lib/email/generator.py	(original)
+++ python/branches/py3k/Lib/email/generator.py	Wed Jan 26 01:39:19 2011
@@ -377,8 +377,11 @@
     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)
 


More information about the Python-checkins mailing list