1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Refs #23919 -- Removed a Python 2 code path in force_text().

Reverted the obsolete fix and tests for refs #12302.
This commit is contained in:
Tim Graham
2017-02-03 19:38:33 -05:00
committed by GitHub
parent 26619ad7b0
commit 2d899ce16b
7 changed files with 16 additions and 49 deletions

View File

@@ -66,16 +66,7 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'):
else:
s = str(s)
except UnicodeDecodeError as e:
if not isinstance(s, Exception):
raise DjangoUnicodeDecodeError(s, *e.args)
else:
# If we get to here, the caller has passed in an Exception
# subclass populated with non-ASCII bytestring data without a
# working __str__() method. Try to handle this without raising a
# further exception by individually forcing the exception args
# to strings.
s = ' '.join(force_text(arg, encoding, strings_only, errors)
for arg in s)
raise DjangoUnicodeDecodeError(s, *e.args)
return s