summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2019-05-03 13:12:54 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-06-08 06:38:11 +0200
commitf5817c24f44aa90188757ddca1e5e63ba6f5df75 (patch)
tree304f8df84d43d3ad233ee51112991e63a75ccb3a /django/utils
parent5f2308710b5a3d9f5f135b7ade08214f5c154ec4 (diff)
Refs #34445 -- Fixed string-casting of non-string lazy objects when value may be bytes.
If the result type is bytes, then calling bytes() on it does nothing. If the result type is not bytes, we should not cast to bytes, just because the return value may be bytes.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/functional.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 666651bd2e..2771851eae 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -144,10 +144,7 @@ def lazy(func, *resultclasses):
return bytes(func(*self.__args, **self.__kw))
def __cast(self):
- if self._delegate_bytes:
- return self.__bytes_cast()
- else:
- return func(*self.__args, **self.__kw)
+ return func(*self.__args, **self.__kw)
def __str__(self):
# object defines __str__(), so __prepare_class__() won't overload