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 <>
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 <> <>\n\n", policy=default)
>>> m['To']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rdmurray/python/p38/Lib/email/", line 391, in __getitem__
    return self.get(name)
  File "/home/rdmurray/python/p38/Lib/email/", line 471, in get
    return self.policy.header_fetch_parse(k, v)
  File "/home/rdmurray/python/p38/Lib/email/", line 163, in header_fetch_parse
    return self.header_factory(name, value)
  File "/home/rdmurray/python/p38/Lib/email/", line 602, in __call__
    return self[name](name, value)
  File "/home/rdmurray/python/p38/Lib/email/", line 197, in __new__
    cls.parse(value, kwds)
  File "/home/rdmurray/python/p38/Lib/email/", line 343, in parse
  File "/home/rdmurray/python/p38/Lib/email/", line 315, in display_name
    return self[0].display_name
  File "/home/rdmurray/python/p38/Lib/email/", line 382, in display_name
    return self[0].display_name
  File "/home/rdmurray/python/p38/Lib/email/", line 564, in display_name
    if res[0].token_type == 'cfws':
IndexError: list index out of range
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: <>
2019-07-10 00:57:54r.david.murraylinkissue32178 messages
2019-07-10 00:57:53r.david.murraycreate