From 36fc6b6ce0d3629b6c5aea6b59a9b465f65a731f Mon Sep 17 00:00:00 2001 From: Yuki Kobayashi Date: Fri, 21 Feb 2025 04:10:57 +0000 Subject: [PATCH 1/2] gh-130433: Update documentation for `MultipartConversionError` --- Doc/library/email.errors.rst | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst index f8f43d82a3df2e8..f4cf9dcdbdfb203 100644 --- a/Doc/library/email.errors.rst +++ b/Doc/library/email.errors.rst @@ -45,16 +45,8 @@ The following exception classes are defined in the :mod:`email.errors` module: .. exception:: MultipartConversionError() - Raised when a payload is added to a :class:`~email.message.Message` object - using :meth:`add_payload`, but the payload is already a scalar and the - message's :mailheader:`Content-Type` main type is not either - :mimetype:`multipart` or missing. :exc:`MultipartConversionError` multiply - inherits from :exc:`MessageError` and the built-in :exc:`TypeError`. - - Since :meth:`Message.add_payload` is deprecated, this exception is rarely - raised in practice. However the exception may also be raised if the - :meth:`~email.message.Message.attach` - method is called on an instance of a class derived from + Raised if the :meth:`~email.message.Message.attach` method is called + on an instance of a class derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). From 434e3f969d300815e4b0d2ee34a0b07389cc2668 Mon Sep 17 00:00:00 2001 From: Yuki Kobayashi Date: Tue, 25 Feb 2025 13:20:30 +0000 Subject: [PATCH 2/2] Fixup --- Doc/library/email.errors.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst index f4cf9dcdbdfb203..61142d58ca82804 100644 --- a/Doc/library/email.errors.rst +++ b/Doc/library/email.errors.rst @@ -49,6 +49,8 @@ The following exception classes are defined in the :mod:`email.errors` module: on an instance of a class derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). + :exc:`MultipartConversionError` multiply + inherits from :exc:`MessageError` and the built-in :exc:`TypeError`. .. exception:: HeaderWriteError()