Skip to content

Commit

Permalink
Rework Query._clone to avoid spurious copy of dataset.
Browse files Browse the repository at this point in the history
Fixes #171.
  • Loading branch information
tseaver committed Oct 17, 2014
1 parent 449b15d commit 137bfe2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gcloud/datastore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def _clone(self):
:rtype: :class:`gcloud.datastore.query.Query`
:returns: a copy of 'self'.
"""
clone = copy.deepcopy(self)
clone._dataset = self._dataset # Shallow copy the dataset.
clone = self.__class__(dataset=self._dataset)
clone._pb.CopyFrom(self._pb)
clone._cursor = self._cursor
return clone

def to_protobuf(self):
Expand Down

0 comments on commit 137bfe2

Please sign in to comment.