Bug report
Bug description:
I encountered this while working on improving the header_value_parser tests. This is an unlikely edge case. After fixing it, we can fix a little niggle in the header parser (see PR).
>>> from email import message_from_string >>> from email.policy import default >>> m = message_from_string('To: "\n\n', policy=default) >>> m['to'].mailboxes.username Traceback (most recent call last): ... File "/home/rdmurray/cpython/main/Lib/email/_header_value_parser.py", line 647, in local_part tok[0].token_type == 'cfws'): ~~~^^^ IndexError: list index out of range
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response