Skip to content

Commit

Permalink
🐛 Fix deepcopy not copying metadata in __diot__
Browse files Browse the repository at this point in the history
  • Loading branch information
pwwang committed Oct 20, 2023
1 parent 267f6a1 commit d7eef33
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 56 deletions.
9 changes: 4 additions & 5 deletions diot/diot.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,10 @@ def copy(self) -> "Diot":
__copy__ = copy

def __deepcopy__(self, memo: Optional[Dict[int, Any]] = None) -> "Diot":
out = self.__class__(
diot_nest=self.__diot__["nest"],
diot_transform=self.__diot__["transform"],
diot_frozen=self.__diot__["frozen"],
)
out = self.__class__()
for dk, dv in self.__diot__.items():
out.__diot__[dk] = deepcopy(dv)

memo = memo or {}
memo[id(self)] = out
for key, value in self.items():
Expand Down
112 changes: 61 additions & 51 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7eef33

Please sign in to comment.