From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 26 Feb 2025 08:59:19 +0000 (+0100) Subject: [3.12] gh-130433: Update documentation for `MultipartConversionError` (GH-130436... X-Git-Tag: v3.12.10~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2592402bbae0567f9688dfbfabcb45faf8a2170b;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-130433: Update documentation for `MultipartConversionError` (GH-130436) (GH-130566) (cherry picked from commit b536e371044f9e9b1b34cc8276a01e67550b5428) Co-authored-by: Yuki Kobayashi --- diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst index f8f43d82a3df..61142d58ca82 100644 --- a/Doc/library/email.errors.rst +++ b/Doc/library/email.errors.rst @@ -45,18 +45,12 @@ 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`). + :exc:`MultipartConversionError` multiply + inherits from :exc:`MessageError` and the built-in :exc:`TypeError`. .. exception:: HeaderWriteError()