Browse Source

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
tags/1.61.0
Julien Danjou 1 year ago
parent
commit
62fd552e1e
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      tooz/partitioner.py

+ 1
- 1
tooz/partitioner.py View File

@@ -53,7 +53,7 @@ class Partitioner(object):
53 53
     def _hash_object(obj):
54 54
         if hasattr(obj, "__tooz_hash__"):
55 55
             return obj.__tooz_hash__()
56
-        return str(hash(obj)).encode('ascii')
56
+        return str(obj).encode()
57 57
 
58 58
     def members_for_object(self, obj, ignore_members=None, replicas=1):
59 59
         """Return the members responsible for an object.

Loading…
Cancel
Save