Skip to content

Commit

Permalink
[3.13] gh-121542: Document trailing newline behavior in `set_content(…
Browse files Browse the repository at this point in the history
…)` (GH-121543) (#128995)

gh-121542: Document trailing newline behavior in `set_content()` (GH-121543)
(cherry picked from commit fba475a)

Co-authored-by: Peter Bierma <[email protected]>
Co-authored-by: Yizheng Meng <[email protected]>
  • Loading branch information
3 people authored Jan 18, 2025
1 parent fdac362 commit b7ddcc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Doc/library/email.contentmanager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,13 @@ Currently the email package provides only one concrete content manager,
:exc:`ValueError`.

* For ``str`` objects, if *cte* is not set use heuristics to
determine the most compact encoding.
determine the most compact encoding. Prior to encoding,
:meth:`str.splitlines` is used to normalize all line boundaries,
ensuring that each line of the payload is terminated by the
current policy's :data:`~email.policy.Policy.linesep` property
(even if the original string did not end with one).
* For ``bytes`` objects, *cte* is taken to be base64 if not set,
and the aforementioned newline translation is not performed.
* For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise
an error if a *cte* of ``quoted-printable`` or ``base64`` is
requested for *subtype* ``rfc822``, and for any *cte* other than
Expand Down

0 comments on commit b7ddcc3

Please sign in to comment.