Fix Dependency provider copying issue

This commit is contained in:
Roman Mogylatov 2021-02-11 09:09:52 -05:00
parent 7ef3c63ca9
commit e29040d2ee
2 changed files with 5698 additions and 5686 deletions

File diff suppressed because it is too large Load Diff

View File

@ -632,14 +632,16 @@ cdef class Dependency(Provider):
if self.__default is not UNDEFINED if self.__default is not UNDEFINED
else UNDEFINED else UNDEFINED
) )
copied_parent = (
deepcopy(self.__parent, memo)
if is_provider(self.parent) or is_container_instance(self.parent)
else self.parent
)
copied = self.__class__(self.__instance_of, copied_default) copied = self.__class__(self.__instance_of, copied_default)
memo[id(self)] = copied
# TODO: introduce .set_default() for consistency # TODO: introduce .set_default() for consistency
copied_parent = (
deepcopy(self.__parent, memo)
if is_provider(self.__parent) or is_container_instance(self.__parent)
else self.__parent
)
copied.set_parent(copied_parent) copied.set_parent(copied_parent)
self._copy_overridings(copied, memo) self._copy_overridings(copied, memo)