Skip to content

Commit 137bfe2

Browse files
committed
Rework Query._clone to avoid spurious copy of dataset.
Fixes #171.
1 parent 449b15d commit 137bfe2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

gcloud/datastore/query.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ def _clone(self):
6767
:rtype: :class:`gcloud.datastore.query.Query`
6868
:returns: a copy of 'self'.
6969
"""
70-
clone = copy.deepcopy(self)
71-
clone._dataset = self._dataset # Shallow copy the dataset.
70+
clone = self.__class__(dataset=self._dataset)
71+
clone._pb.CopyFrom(self._pb)
72+
clone._cursor = self._cursor
7273
return clone
7374

7475
def to_protobuf(self):

0 commit comments

Comments
 (0)