Skip to content

Commit 98af86a

Browse files
committed
PYTHON-952 - Fix an issue with killCursors handling
1 parent 0e4f79c commit 98af86a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pymongo/message.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,20 @@ def namespace(self):
232232
"""The namespace this cursor."""
233233
return self.__namespace
234234

235+
def __hash__(self):
236+
# Two _CursorAddress instances with different namespaces
237+
# must not hash the same.
238+
return (self + (self.__namespace,)).__hash__()
239+
240+
def __eq__(self, other):
241+
if isinstance(other, _CursorAddress):
242+
return (tuple(self) == tuple(other)
243+
and self.namespace == other.namespace)
244+
return NotImplemented
245+
246+
def __ne__(self, other):
247+
return not self == other
248+
235249

236250
def __last_error(namespace, args):
237251
"""Data to send to do a lastError.

0 commit comments

Comments
 (0)