summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/message.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py
index 88b5fa3..b4bc8cb 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -203,7 +203,11 @@ class Message:
if self._payload is None:
self._payload = [payload]
else:
- self._payload.append(payload)
+ try:
+ self._payload.append(payload)
+ except AttributeError:
+ raise TypeError("Attach is not valid on a message with a"
+ " non-multipart payload")
def get_payload(self, i=None, decode=False):
"""Return a reference to the payload.