Message383564
I can also confirm this bug, with Python 3.9.1 on Debian GNU/Linux ('testing' distro up-to-date as of 2020-12-21).
1) Create a parser `p` with `p = email.parser.HeaderParser(policy=email.policy.default)`.
2) Parse a single problematic (as described below) message: `msg_headers = p.parsestr(msg_str)`
3) Try to get the To field: `msg_headers.get_all('to', [ ])` and get an exception raised: `AttributeError: 'str' object has no attribute 'token_type'` (with the same stack trace as OP shows).
Here is a minimal problematic message you can reproduce this with (i.e., just make `msg_str` have this string value):
```
From nobody Mon Dec 21 12:00:00 2020
From: sender@example.com
To: . <jrandom@example.com>
Date: Mon, 21 Dec 2020 12:00:00 -0000
Message-ID: <87ab5rvds7.fsf@example.com>
Subject: This is the Subject header.
Here is the body of the message.
```
Note that *any* number of dots for the recipient's name would also result in an error. The above example uses just ".", but it could be "..", "...", ".................", etc. |
|
Date |
User |
Action |
Args |
2020-12-22 01:39:34 | kfogel | set | recipients:
+ kfogel, barry, ncoghlan, r.david.murray, timb07, cnicodeme, Steven Hilton |
2020-12-22 01:39:34 | kfogel | set | messageid: <1608601174.25.0.312200063799.issue30988@roundup.psfhosted.org> |
2020-12-22 01:39:34 | kfogel | link | issue30988 messages |
2020-12-22 01:39:33 | kfogel | create | |
|