diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-08-16 11:50:25 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-19 12:52:26 -0700 |
commit | fa3dd1b04567c4ea03fa658c3838b569531c79f5 (patch) | |
tree | 6ffc0eedbf03b11ed87f92bd609bca6533ed64aa /alot/db/utils.py | |
parent | dee41bb04906d6976b4f7c05c222f7d95182b3ea (diff) |
Use io.BytesIO and io.StringIO
In python3 StringIO and cStringIO are gone. In their place are
io.BytesIO and io.StringIO. They are somewhat different in that they are
not separated on implementation, but on the type they emulated. BytesIO
works like the bytes class (str in python 2), while StringIO works like
the str class (unicode in python2).
Diffstat (limited to 'alot/db/utils.py')
-rw-r--r-- | alot/db/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py index c24ffef1..488e0ed7 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -15,7 +15,7 @@ import tempfile import re import logging import mailcap -from cStringIO import StringIO +from io import BytesIO from .. import crypto from .. import helper @@ -264,14 +264,14 @@ def message_from_file(handle): def message_from_string(s): '''Reads a mail from the given string. This is the equivalent of :func:`email.message_from_string` which does nothing but to wrap - the given string in a StringIO object and to call + the given string in a BytesIO object and to call :func:`email.message_from_file`. Please refer to the documentation of :func:`message_from_file` for details. ''' - return message_from_file(StringIO(s)) + return message_from_file(BytesIO(s)) def extract_headers(mail, headers=None): |