Skip to content

Commit

Permalink
Review StructuredRow copy/clone methods (close #477)
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Oct 13, 2024
1 parent f41bafe commit dca769a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions emmett/orm/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ def __eq__(self, other):
return self._fields == other._fields and self.__dict__ == other.__dict__

def __copy__(self):
return StructuredRow(self._fields, __concrete=self._concrete, **self.__dict__)
return self.__class__(dict(self._fields), __concrete=self._concrete, **self.__dict__)

def keys(self):
for pool in (self._fields, self.__dict__):
Expand Down Expand Up @@ -1294,8 +1294,7 @@ def clone(self):
fields[key] = self._fields[key]
return self.__class__(fields, __concrete=self._concrete, **self.__dict__)

def clone_changed(self):
return self.__class__({**self._fields}, __concrete=self._concrete, **self.__dict__)
clone_changed = __copy__

@property
def validation_errors(self):
Expand Down

0 comments on commit dca769a

Please sign in to comment.