Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multipart Emails: Python2 bug #429

Closed
seshrs opened this issue Jan 19, 2019 · 0 comments · Fixed by #430
Closed

Multipart Emails: Python2 bug #429

seshrs opened this issue Jan 19, 2019 · 0 comments · Fixed by #430

Comments

@seshrs
Copy link
Contributor

seshrs commented Jan 19, 2019

A bug in future.backports.email.Message.set_boundary causes errors when serializing multipart email Message objects.

Using Python 2.7.15, here is output from serializing a multipart email:

>>> import future.backports.email as email
>>> import future.backports.email.mime.multipart
>>> m = email.mime.multipart.MIMEMultipart()
>>> m.as_string()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/future/backports/email/message.py", line 155, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/local/lib/python2.7/site-packages/future/backports/email/generator.py", line 118, in flatten
    self._write(msg)
  File "/usr/local/lib/python2.7/site-packages/future/backports/email/generator.py", line 190, in _write
    self._write_headers(msg)
  File "/usr/local/lib/python2.7/site-packages/future/backports/email/generator.py", line 216, in _write_headers
    for h, v in msg.raw_items():
  File "/usr/local/lib/python2.7/site-packages/future/backports/email/message.py", line 446, in raw_items
    return iter(self._headers.copy())
AttributeError: 'list' object has no attribute 'copy'

Another example indicating the source of the bug:

>>> import future.backports.email as email
>>> import future.backports.email.mime.multipart
>>> m = email.mime.multipart.MIMEMultipart()
>>> type(m._headers)
<class 'future.types.newlist.newlist'>
>>> m.set_boundary('===============6387699881409002085==')
>>> type(m._headers)
<type 'list'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant