diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-06-01 10:47:46 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-03-01 10:34:56 -0800 |
commit | 54aec2ce7b75f6e22bf26410cdc6cc931bdf1089 (patch) | |
tree | 958f0a5c5bd1749b48940d0d8a29eb998654d86c | |
parent | eb353fde6a5c1588c850db4cc0a28eea4a13b844 (diff) |
py3k: use StringIO from io module instead of cStringIO
cStringIO doesn't exist in python 3.x, instead one simply uses
io.StringIO and python provided a C accelerated version if possible.
-rw-r--r-- | alot/commands/thread.py | 4 | ||||
-rw-r--r-- | alot/db/utils.py | 6 | ||||
-rw-r--r-- | alot/helper.py | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 609a4f3a..5e014142 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -14,7 +14,7 @@ from email.utils import getaddresses, parseaddr, formataddr from email.message import Message from twisted.internet.defer import inlineCallbacks -from io import BytesIO +from io import StringIO from . import Command, registerCommand from .globals import ExternalCommand @@ -993,7 +993,7 @@ class OpenAttachmentCommand(Command): def afterwards(): os.unlink(tempfile_name) else: - handler_stdin = BytesIO() + handler_stdin = StringIO() self.attachment.write(handler_stdin) # create handler command list diff --git a/alot/db/utils.py b/alot/db/utils.py index 14e6ebc9..f57d62bd 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -15,7 +15,7 @@ import tempfile import re import logging import mailcap -from io import BytesIO +from io import StringIO from .. import crypto from .. import helper @@ -265,14 +265,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 BytesIO object and to call + the given string in a StringIO 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(BytesIO(s)) + return message_from_file(StringIO(s)) def extract_headers(mail, headers=None): diff --git a/alot/helper.py b/alot/helper.py index 5fab4819..400d8c0e 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -10,7 +10,7 @@ from datetime import timedelta from datetime import datetime from collections import deque from io import BytesIO -from cStringIO import StringIO +from io import StringIO import logging import mimetypes import os |