summaryrefslogtreecommitdiff
path: root/django/forms/utils.py
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@gmail.com>2014-10-07 00:09:21 +0700
committerLoic Bistuer <loic.bistuer@gmail.com>2014-10-07 00:09:55 +0700
commitec2fd02bb3f9f7e732de1566e81f84637e29f161 (patch)
treefedf4a78bc02adb48602c4ca6e52b0247636ed62 /django/forms/utils.py
parent1edaa55201e5f8c191c6ba7fdeeb88ac0b711ca8 (diff)
downloaddjango-ec2fd02bb3f9f7e732de1566e81f84637e29f161.tar.gz
Fixed #23594 -- Fixed deepcopy on ErrorList.
Thanks Troy Grosfield for the report and Tim Graham for the tests.
Diffstat (limited to 'django/forms/utils.py')
-rw-r--r--django/forms/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/forms/utils.py b/django/forms/utils.py
index 14253f36fe..f5fc0515a5 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -138,6 +138,15 @@ class ErrorList(UserList, list):
return list(error)[0]
return force_text(error)
+ def __reduce_ex__(self, *args, **kwargs):
+ # The `list` reduce function returns an iterator as the fourth element
+ # that is normally used for repopulating. Since we only inherit from
+ # `list` for `isinstance` backward compatibility (Refs #17413) we
+ # nullify this iterator as it would otherwise result in duplicate
+ # entries. (Refs #23594)
+ info = super(UserList, self).__reduce_ex__(*args, **kwargs)
+ return info[:3] + (None, None)
+
# Utilities for time zone support in DateTimeField et al.