mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16:12 +00:00
Fixed #23594 -- Fixed deepcopy on ErrorList.
Thanks Troy Grosfield for the report and Tim Graham for the tests.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user