Pass through memo in __deepcopy__ as required by the docs (#6660)

This is needed to avoid problems with recursive loops. See
https://docs.python.org/3.7/library/copy.html
toward the end.
This commit is contained in:
Ran Benita 2019-05-09 11:20:33 +03:00 committed by Tom Christie
parent a7c577cb31
commit 9811a29a5a

View File

@ -614,7 +614,7 @@ class Field:
for item in self._args
]
kwargs = {
key: (copy.deepcopy(value) if (key not in ('validators', 'regex')) else value)
key: (copy.deepcopy(value, memo) if (key not in ('validators', 'regex')) else value)
for key, value in self._kwargs.items()
}
return self.__class__(*args, **kwargs)