summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2018-01-18 11:28:23 +0100
committerJulien Danjou <julien@danjou.info>2018-01-18 12:05:41 +0100
commit62fd552e1e1f40e265e3bf781170b21bfb5f4626 (patch)
tree55b529626bcc06f6c68b34e7d1bdf2eed3086b4d
parent78caecd878e85e8d770afadac55799dcc314e648 (diff)
partitioner: do not use hash() to determine object identity
The `hash` method is random on Python 3, so it's not consistent between. Just use the string representation of the object as a default. Change-Id: I84e2b19b64dc1641f9758429248dc6b928122b18 Closes-Bug: #1743243
Notes
Notes (review): Code-Review+2: gordon chung <gord@live.ca> Code-Review+2: ChangBo Guo(gcb) <glongwave@gmail.com> Workflow+1: ChangBo Guo(gcb) <glongwave@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 19 Jan 2018 06:29:32 +0000 Reviewed-on: https://review.openstack.org/535280 Project: openstack/tooz Branch: refs/heads/master
-rw-r--r--tooz/partitioner.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tooz/partitioner.py b/tooz/partitioner.py
index dd5fb05..d4a2cb3 100644
--- a/tooz/partitioner.py
+++ b/tooz/partitioner.py
@@ -53,7 +53,7 @@ class Partitioner(object):
53 def _hash_object(obj): 53 def _hash_object(obj):
54 if hasattr(obj, "__tooz_hash__"): 54 if hasattr(obj, "__tooz_hash__"):
55 return obj.__tooz_hash__() 55 return obj.__tooz_hash__()
56 return str(hash(obj)).encode('ascii') 56 return str(obj).encode()
57 57
58 def members_for_object(self, obj, ignore_members=None, replicas=1): 58 def members_for_object(self, obj, ignore_members=None, replicas=1):
59 """Return the members responsible for an object. 59 """Return the members responsible for an object.