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 labrat
Recipients barry, labrat, pas, r.david.murray
Date 2014-11-07.09:17:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415351849.72.0.974335467454.issue22684@psf.upfronthosting.co.za>
In-reply-to
Content
Here's an example from the notmuch list.  You can trigger the exception in Python 3.4 with:

  >>> import email.policy
  >>> import mailbox
  >>> mbox = mailbox.mbox('msg.mbox', factory=None, create=False)
  >>> message = mbox[0]
  >>> message.as_bytes(policy=email.policy.SMTP)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/wking/src/notmuch/ssoma_mda.py", line 319, in deliver
      message_bytes = message.as_bytes(policy=_email_policy.SMTP)
    File "/usr/lib64/python3.4/email/message.py", line 179, in as_bytes
      g.flatten(self, unixfrom=unixfrom)
    File "/usr/lib64/python3.4/email/generator.py", line 112, in flatten
      self._write(msg)
    File "/usr/lib64/python3.4/email/generator.py", line 192, in _write
      self._write_headers(msg)
    …
    File "/usr/lib64/python3.4/email/_header_value_parser.py", line 195, in <genexpr>
      return ''.join(str(x) for x in self)
  RuntimeError: maximum recursion depth exceeded while getting the str of an object

Interestingly, it serializes fine using the default policy:

  >>> message.as_bytes()
  b'Return-Path: …-----\n'
History
Date User Action Args
2014-11-07 09:17:29labratsetrecipients: + labrat, barry, r.david.murray, pas
2014-11-07 09:17:29labratsetmessageid: <1415351849.72.0.974335467454.issue22684@psf.upfronthosting.co.za>
2014-11-07 09:17:29labratlinkissue22684 messages
2014-11-07 09:17:29labratcreate