]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133315: Document that compat32 should not be used with MIMEPart/EmailMessage ...
authorAndrii Hrimov <andrew.hrimov@gmail.com>
Tue, 6 Jan 2026 20:18:37 +0000 (21:18 +0100)
committerGitHub <noreply@github.com>
Tue, 6 Jan 2026 20:18:37 +0000 (15:18 -0500)
Doc/library/email.message.rst
Doc/library/email.policy.rst

index 71d6e321f387bcb6847b5bc9cee35a249ad45679..0aa8e632c2ca808cd61fbb828818857c659be718 100644 (file)
@@ -57,7 +57,7 @@ message objects.
    :class:`~email.policy.default` policy, which follows the rules of the email
    RFCs except for line endings (instead of the RFC mandated ``\r\n``, it uses
    the Python standard ``\n`` line endings).  For more information see the
-   :mod:`~email.policy` documentation.
+   :mod:`~email.policy` documentation. [2]_
 
    .. method:: as_string(unixfrom=False, maxheaderlen=None, policy=None)
 
@@ -749,3 +749,9 @@ message objects.
 .. [1] Originally added in 3.4 as a :term:`provisional module <provisional
        package>`.  Docs for legacy message class moved to
        :ref:`compat32_message`.
+
+.. [2] The :class:`EmailMessage` class requires a policy that provides a
+       ``content_manager`` attribute for content management methods like
+       ``set_content()`` and ``get_content()`` to work. The legacy
+       :const:`~email.policy.compat32` policy does not support these methods
+       and should not be used with :class:`EmailMessage`.
index 6b997ee784f6e444c2df7dc3e408b454165c08dc..1ff3e2c3f8df6b4129fbb299fed41a250c84a7a5 100644 (file)
@@ -662,6 +662,13 @@ The header objects and their attributes are described in
    An instance of :class:`Compat32`, providing  backward compatibility with the
    behavior of the email package in Python 3.2.
 
+   .. note::
+
+      The :const:`compat32` policy should not be used as a policy for
+      :class:`~email.message.EmailMessage` objects, and should only be used
+      to serialize messages that were created using the :const:`compat32`
+      policy.
+
 
 .. rubric:: Footnotes