This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kfogel
Recipients Steven Hilton, barry, cnicodeme, kfogel, ncoghlan, r.david.murray, timb07
Date 2020-12-22.01:39:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608601174.25.0.312200063799.issue30988@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-12-22 01:39:34kfogelsetrecipients: + kfogel, barry, ncoghlan, r.david.murray, timb07, cnicodeme, Steven Hilton
2020-12-22 01:39:34kfogelsetmessageid: <1608601174.25.0.312200063799.issue30988@roundup.psfhosted.org>
2020-12-22 01:39:34kfogellinkissue30988 messages
2020-12-22 01:39:33kfogelcreate