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 r.david.murray
Recipients barry, cheryl.sabella, maxking, mtorromeo, r.david.murray
Date 2019-07-10.00:57:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562720274.2.0.652315027916.issue32178@roundup.psfhosted.org>
In-reply-to
Content
The fact that the original report mentions HeaderParserError implies that the new API is being used, though the report didn't make that clear.  The problem still exists:

>>> m = message_from_string("To: :Foo <foo@example.com> <bar@example.com>\n\n", policy=default)
>>> m['To']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rdmurray/python/p38/Lib/email/message.py", line 391, in __getitem__
    return self.get(name)
  File "/home/rdmurray/python/p38/Lib/email/message.py", line 471, in get
    return self.policy.header_fetch_parse(k, v)
  File "/home/rdmurray/python/p38/Lib/email/policy.py", line 163, in header_fetch_parse
    return self.header_factory(name, value)
  File "/home/rdmurray/python/p38/Lib/email/headerregistry.py", line 602, in __call__
    return self[name](name, value)
  File "/home/rdmurray/python/p38/Lib/email/headerregistry.py", line 197, in __new__
    cls.parse(value, kwds)
  File "/home/rdmurray/python/p38/Lib/email/headerregistry.py", line 343, in parse
    groups.append(Group(addr.display_name,
  File "/home/rdmurray/python/p38/Lib/email/_header_value_parser.py", line 315, in display_name
    return self[0].display_name
  File "/home/rdmurray/python/p38/Lib/email/_header_value_parser.py", line 382, in display_name
    return self[0].display_name
  File "/home/rdmurray/python/p38/Lib/email/_header_value_parser.py", line 564, in display_name
    if res[0].token_type == 'cfws':
IndexError: list index out of range
History
Date User Action Args
2019-07-10 00:57:54r.david.murraysetrecipients: + r.david.murray, barry, maxking, cheryl.sabella, mtorromeo
2019-07-10 00:57:54r.david.murraysetmessageid: <1562720274.2.0.652315027916.issue32178@roundup.psfhosted.org>
2019-07-10 00:57:54r.david.murraylinkissue32178 messages
2019-07-10 00:57:53r.david.murraycreate