diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2023-11-21 15:37:28 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-11-27 10:37:29 +0100 |
| commit | 174369a990c00d75cf40e0a06ab82bec9a89a7ef (patch) | |
| tree | 26b73f240dd786343abac6087e62bc3ab075a1e9 /django/utils | |
| parent | 0257426fe1fe9d146fd5813f09d909917ff59360 (diff) | |
Refs #34986 -- Avoided pickling error in DjangoUnicodeDecodeError.
By using the existing object reference instead of a custom one, pickling
related issues when running the test suite in parallel can be avoided.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/encoding.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/django/utils/encoding.py b/django/utils/encoding.py index 5986993759..e57e2a2ba1 100644 --- a/django/utils/encoding.py +++ b/django/utils/encoding.py @@ -9,15 +9,11 @@ from django.utils.functional import Promise class DjangoUnicodeDecodeError(UnicodeDecodeError): - def __init__(self, obj, *args): - self.obj = obj - super().__init__(*args) - def __str__(self): return "%s. You passed in %r (%s)" % ( super().__str__(), - self.obj, - type(self.obj), + self.object, + type(self.object), ) @@ -72,7 +68,7 @@ def force_str(s, encoding="utf-8", strings_only=False, errors="strict"): else: s = str(s) except UnicodeDecodeError as e: - raise DjangoUnicodeDecodeError(s, *e.args) + raise DjangoUnicodeDecodeError(*e.args) from None return s |
