Skip to content

Commit

Permalink
Fixed deepcopy with pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Jul 15, 2022
1 parent 37fed12 commit f7d59a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions benedict/dicts/base/base_dict.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

from benedict.core import clone as _clone


class BaseDict(dict):

Expand Down Expand Up @@ -37,6 +39,12 @@ def __contains__(self, key):
return key in self._dict
return super(BaseDict, self).__contains__(key)

def __deepcopy__(self, memo):
obj = self.__class__()
for key, value in self.items():
obj[key] = _clone(value, memo=memo)
return obj

def __delitem__(self, key):
if self._pointer:
del self._dict[key]
Expand Down

0 comments on commit f7d59a2

Please sign in to comment.