summaryrefslogtreecommitdiff
path: root/django/forms
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:14:11 +0700
commit082abce81e48fe9397cce096e13d5199c99adfe9 (patch)
tree5cf6ee0bcc77314035d0663da18a089576b1ff3c /django/forms
parent2999bf055a121aaa8cc5da7e11fe513107e88f7d (diff)
[1.7.x] Fixed #23594 -- Fixed deepcopy on ErrorList.
Thanks Troy Grosfield for the report and Tim Graham for the tests. Backport of ec2fd02bb3 from master
Diffstat (limited to 'django/forms')
-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 2147014a5d..aa14e6fe55 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -131,6 +131,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.