Author frispete
Recipients barry, frispete, r.david.murray
Date 2016-06-07.19:24:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In the course of replacing an old Python 2.7 email filter tool with a rewritten Python3 version, I stumbled across a ugly case, where such an header:

To: unlisted-recipients: ;,
        "" (no To-header on input)

results in a Traceback (most recent call last):
  File "./", line 606, in <module>
    ret =
  File "./", line 595, in run
  File "./", line 520, in process
    config.recipients = self.get_addresses('to', msg)
  File "./", line 103, in get_addresses
    vals = msg.get_all(field, [])
  File "/usr/lib64/python3.4/email/", line 511, in get_all
    values.append(self.policy.header_fetch_parse(k, v))
  File "/usr/lib64/python3.4/email/", line 145, in header_fetch_parse
    return self.header_factory(name, ''.join(value.splitlines()))
  File "/usr/lib64/python3.4/email/", line 584, in __call__
    return self[name](name, value)
  File "/usr/lib64/python3.4/email/", line 195, in __new__
    cls.parse(value, kwds)
  File "/usr/lib64/python3.4/email/", line 342, in parse
    for mb in addr.all_mailboxes]))
  File "/usr/lib64/python3.4/email/", line 342, in <listcomp>
    for mb in addr.all_mailboxes]))
  File "/usr/lib64/python3.4/email/", line 837, in local_part
    return self[0].local_part
  File "/usr/lib64/python3.4/email/", line 889, in local_part
    return self[0].local_part
  File "/usr/lib64/python3.4/email/", line 984, in local_part
    tok[0].token_type == 'cfws'):
IndexError: list index out of range

I'm not completely sure, if the Top header, as added from my email provider, is perfectly valid, but none of the other parts of my mail infrastructure neither complained, nor behave strange with such headers.

This happens with 3.4.4, but also with the email module from current hg for testing.
Date User Action Args
2016-06-07 19:24:55frispetesetrecipients: + frispete, barry, r.david.murray
2016-06-07 19:24:53frispetesetmessageid: <>
2016-06-07 19:24:53frispetelinkissue27257 messages
2016-06-07 19:24:53frispetecreate