Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Used io.BytesIO also for ContentFile.

io.StringIO would force the content to be Unicode, which would be
slightly backwards incompatible.
  • Loading branch information...
1 parent d7dfab5 commit 57102ce7819ecc3df3e979a4926d0cecc09c6f6e @claudep claudep committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/core/files/
4 django/core/files/
@@ -1,5 +1,5 @@
import os
-from io import BytesIO, StringIO
+from io import BytesIO
from django.utils.encoding import smart_str, smart_unicode
from django.core.files.utils import FileProxyMixin
@@ -126,7 +126,7 @@ class ContentFile(File):
def __init__(self, content, name=None):
content = content or ''
- super(ContentFile, self).__init__(StringIO(content), name=name)
+ super(ContentFile, self).__init__(BytesIO(content), name=name)
self.size = len(content)
def __str__(self):

0 comments on commit 57102ce

Please sign in to comment.
Something went wrong with that request. Please try again.