Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 994d380

Browse files
committed
Add entry for the mailbox fixups.
1 parent b7deff1 commit 994d380

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Doc/whatsnew/3.2.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,34 @@ parameters, the return types will also be an ASCII-encoded byte strings:
21442144
(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`,
21452145
:issue:`5468`, and :issue:`9873`.)
21462146

2147+
mailbox
2148+
-------
2149+
2150+
Thanks to a concerted effort by R. David Murray, the :mod:`mailbox` module has
2151+
been fixed for Python 3.2. The challenge was that mailbox had been originally
2152+
designed with a text interface, but email messages are best represented with
2153+
:class:`bytes` because various parts of a message may have different encodings.
2154+
2155+
The solution harnessed the :mod:`email` package's binary support for parsing
2156+
arbitrary email messages. In addition, the solution required a number of API
2157+
changes.
2158+
2159+
As expected, the :meth:`~mailbox.Mailbox.add` method for
2160+
:class:`mailbox.Mailbox` objects now accepts binary input.
2161+
2162+
:class:`~io.StringIO` and text file input are deprecated. Also, string input
2163+
will fail early if non-ASCII characters are used. Previously it would fail when
2164+
the email was processed in a later step.
2165+
2166+
There is also support for binary output. The :meth:`~mailbox.Mailbox.get_file`
2167+
method now returns a file in the binary mode (where it used to incorrectly set
2168+
the file to text-mode). There is also a new :meth:`~mailbox.Mailbox.get_bytes`
2169+
method that returns a :class:`bytes` representation of a message corresponding
2170+
to a given *key*.
2171+
2172+
(Contributed by R. David Murray with efforts from Steffen Daode Nurpmeso and
2173+
Victor Stinner in :issue:`9124`.)
2174+
21472175
turtledemo
21482176
----------
21492177

0 commit comments

Comments
 (0)