From 3841feee86cae65165f120db7a5d80ffc76dd520 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Thu, 20 Feb 2014 19:13:25 +0100 Subject: Fixed #22107 -- Fixed django.core.files.File object iteration. Due to a mixup between text and bytes, iteration over a File instance was broken under Python 3. Thanks to trac user pdewacht for the report and patch. --- django/core/files/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django') diff --git a/django/core/files/base.py b/django/core/files/base.py index b1325291c6..641ff924c6 100644 --- a/django/core/files/base.py +++ b/django/core/files/base.py @@ -104,7 +104,7 @@ class File(FileProxyMixin): # If this is the end of a line, yield # otherwise, wait for the next round - if line[-1] in ('\n', '\r'): + if line[-1:] in (b'\n', b'\r'): yield line else: buffer_ = line -- cgit v1.3