mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
This reverts commit 18dfbd0357
.
Adds a regression test from the issue.
See https://github.com/python/cpython/issues/106669.
This commit is contained in:
parent
d81b4f8ff8
commit
a31dea1feb
5 changed files with 30 additions and 171 deletions
|
@ -65,11 +65,6 @@ of the new API.
|
|||
*email address* parts. Returns a tuple of that information, unless the parse
|
||||
fails, in which case a 2-tuple of ``('', '')`` is returned.
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
For security reasons, addresses that were ambiguous and could parse into
|
||||
multiple different addresses now cause ``('', '')`` to be returned
|
||||
instead of only one of the *potential* addresses.
|
||||
|
||||
|
||||
.. function:: formataddr(pair, charset='utf-8')
|
||||
|
||||
|
@ -92,7 +87,7 @@ of the new API.
|
|||
This method returns a list of 2-tuples of the form returned by ``parseaddr()``.
|
||||
*fieldvalues* is a sequence of header field values as might be returned by
|
||||
:meth:`Message.get_all <email.message.Message.get_all>`. Here's a simple
|
||||
example that gets all the recipients of a message:
|
||||
example that gets all the recipients of a message::
|
||||
|
||||
from email.utils import getaddresses
|
||||
|
||||
|
@ -102,25 +97,6 @@ of the new API.
|
|||
resent_ccs = msg.get_all('resent-cc', [])
|
||||
all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)
|
||||
|
||||
When parsing fails for a single fieldvalue, a 2-tuple of ``('', '')``
|
||||
is returned in its place. Other errors in parsing the list of
|
||||
addresses such as a fieldvalue seemingly parsing into multiple
|
||||
addresses may result in a list containing a single empty 2-tuple
|
||||
``[('', '')]`` being returned rather than returning potentially
|
||||
invalid output.
|
||||
|
||||
Example malformed input parsing:
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> from email.utils import getaddresses
|
||||
>>> getaddresses(['alice@example.com <bob@example.com>', 'me@example.com'])
|
||||
[('', '')]
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
The 2-tuple of ``('', '')`` in the returned values when parsing
|
||||
fails were added as to address a security issue.
|
||||
|
||||
|
||||
.. function:: parsedate(date)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue