Pass through memo in __deepcopy__ as required by the docs

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-08 14:41:38 +03:00
parent 564faddb0f
commit e476143e7d

View File

@ -614,7 +614,7 @@ class Field:
for item in self._args for item in self._args
] ]
kwargs = { 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() for key, value in self._kwargs.items()
} }
return self.__class__(*args, **kwargs) return self.__class__(*args, **kwargs)