diff --git a/django/core/mail/message.py b/django/core/mail/message.py index e8d209c9da..9092cce9c1 100644 --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -14,6 +14,7 @@ from email.mime.message import MIMEMessage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import formataddr, formatdate, getaddresses, parseaddr +from io import BytesIO from django.conf import settings from django.core.mail.utils import DNS_NAME @@ -145,7 +146,7 @@ class MIMEMixin(): This overrides the default as_bytes() implementation to not mangle lines that begin with 'From '. See bug #13433 for details. """ - fp = six.BytesIO() + fp = BytesIO() g = generator.BytesGenerator(fp, mangle_from_=False) g.flatten(self, unixfrom=unixfrom, linesep=linesep) return fp.getvalue() diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index e6814aacdf..2fe1499738 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -9,6 +9,7 @@ import os import shutil import tempfile as sys_tempfile import unittest +from io import BytesIO from django.core.files import temp as tempfile from django.core.files.uploadedfile import SimpleUploadedFile @@ -16,7 +17,7 @@ from django.http.multipartparser import MultiPartParser, parse_header from django.test import SimpleTestCase, TestCase, client, override_settings from django.utils.encoding import force_bytes from django.utils.http import urlquote -from django.utils.six import PY2, BytesIO, StringIO +from django.utils.six import PY2, StringIO from . import uploadhandler from .models import FileModel diff --git a/tests/servers/test_basehttp.py b/tests/servers/test_basehttp.py index 91dcaa17d9..b9008be8e8 100644 --- a/tests/servers/test_basehttp.py +++ b/tests/servers/test_basehttp.py @@ -1,9 +1,10 @@ +from io import BytesIO + from django.core.handlers.wsgi import WSGIRequest from django.core.servers.basehttp import WSGIRequestHandler from django.test import SimpleTestCase from django.test.client import RequestFactory from django.test.utils import captured_stderr -from django.utils.six import BytesIO class Stub(object):