Implement deepcopy handler for FactoryAggregate provider

This commit is contained in:
Roman Mogylatov 2019-05-09 14:40:01 -04:00
parent 236db929c2
commit 91f4c1f568
3 changed files with 992 additions and 781 deletions

View File

@ -9,6 +9,7 @@ follows `Semantic versioning`_
Development version
-------------------
- Fix copying issue with ``FactoryAggregate`` provider.
- Regenerate C sources using Cython 0.29.7.
3.14.5

File diff suppressed because it is too large Load Diff

View File

@ -1449,6 +1449,21 @@ cdef class FactoryAggregate(Provider):
self.__factories = factories
super(FactoryAggregate, self).__init__()
def __deepcopy__(self, memo):
"""Create and return full copy of provider."""
cdef FactoryAggregate copied
copied = memo.get(id(self))
if copied is not None:
return copied
copied = self.__class__()
copied.__factories = deepcopy(self.__factories, memo)
self._copy_overridings(copied, memo)
return copied
def __call__(self, factory_name, *args, **kwargs):
"""Create new object using factory with provided name.