mirror of
https://github.com/python/cpython.git
synced 2026-05-05 01:51:01 +00:00
When an address in an address-list has garbage at the end, the code will currently: 1. change the mailbox in the last parsed address into invalid-mailbox by overriding its token_type; 2. wrap the trailing garbage into another invalid-mailbox and append it to the last parsed address. However, that does not take into account that an address may also contain a Group instead of a single mailbox. In that case, overwriting token_type leads to undesirable results, e.g. parsing an email with the following 'To' header: unlisted-recipients:; (no To-header on input) raises an AttributeError from trying to treat the Group as a Mailbox. Moreover it is questionable whether the previously parsed mailbox should be treated as invalid in addition to the trailing garbage. Address both of the above by wrapping the trailing garbage in a new Address with a single invalid-mailbox, and append it to the AddressList directly. Changes the results of the test_get_address_list_mailboxes_invalid_addresses test, where the address list is now parsed into 4 mailboxes instead of 3 (all but the first one are invalid). |
||
|---|---|---|
| .. | ||
| data | ||
| __init__.py | ||
| __main__.py | ||
| test__encoded_words.py | ||
| test__header_value_parser.py | ||
| test_asian_codecs.py | ||
| test_contentmanager.py | ||
| test_defect_handling.py | ||
| test_email.py | ||
| test_generator.py | ||
| test_headerregistry.py | ||
| test_inversion.py | ||
| test_message.py | ||
| test_parser.py | ||
| test_pickleable.py | ||
| test_policy.py | ||
| test_utils.py | ||
| torture_test.py | ||