[issue22684] message.as_bytes() produces recursion depth exceeded

W. Trevor King report at bugs.python.org
Fri Nov 7 10:57:36 CET 2014


W. Trevor King added the comment:

The troublesome header formatting is:

  >>> import email.policy
  >>> email.policy.SMTP.fold_binary('Cc', 'notmuch\n\t<public-public-notmuch-gxuj+Tv9EO5zyzON3hdc1g-wOFGN7rlS/M9smdsby/KFg at plane.gmane.org>,\n\tpublic-notmuch-gxuj+Tv9EO5zyzON3hdc1g at plane.gmane.org,\n\tRainer M Krug <public-R.M.Krug-Re5JQEeQqe8AvxtiuMwx3w at plane.gmane.org>,\n\tJeremy Nickurak\n\t<public-public-not-much-kexSNQTsIoD754YsiR0rpA-wOFGN7rlS/M9smdsby/KFg at plane.gmane.org>')
  Traceback (most recent call last):
    …
  RuntimeError: maximum recursion depth exceeded while getting the str of an object

Trimming that down a bit, a minimal trigger seems to be:

  >>> email.policy.SMTP.fold_binary('Cc', 'a\n\taaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n\ta')
  Traceback…

Where removing much of anything gives a working fold.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22684>
_______________________________________


More information about the Python-bugs-list mailing list