summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Objects/object.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 323ed54b51..44344f9b2c 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -914,7 +914,7 @@ PyObject_Hash(PyObject *v)
PyTypeObject *tp = v->ob_type;
if (tp->tp_hash != NULL)
return (*tp->tp_hash)(v);
- if (tp->tp_compare == NULL) {
+ if (tp->tp_compare == NULL && tp->tp_richcompare == NULL) {
return _Py_HashPointer(v); /* Use address as hash value */
}
/* If there's a cmp but no hash defined, the object can't be hashed */