summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2008-07-15 15:46:38 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2008-07-15 15:46:38 (GMT)
commitd1abd25ed8e14a64da21d17ece73c49390b9b083 (patch)
tree21c0fbf58c0b0a05268ccdf538716f2f75dd5576 /Objects/object.c
parente65282114e96efb9e7eee77c57244943b746f6fe (diff)
downloadcpython-d1abd25ed8e14a64da21d17ece73c49390b9b083.zip
cpython-d1abd25ed8e14a64da21d17ece73c49390b9b083.tar.gz
cpython-d1abd25ed8e14a64da21d17ece73c49390b9b083.tar.bz2
Manual forward port of 64962 - use PyObject_HashNotImplemented as a tp_hash level indicator that the default hash implementation has not been inherited
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 85bb850..ff16994 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -781,17 +781,22 @@ finally:
#endif
}
+long
+PyObject_HashNotImplemented(PyObject *v)
+{
+ PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
+ Py_TYPE(v)->tp_name);
+ return -1;
+}
long
PyObject_Hash(PyObject *v)
{
- PyTypeObject *tp = v->ob_type;
+ PyTypeObject *tp = Py_TYPE(v);
if (tp->tp_hash != NULL)
return (*tp->tp_hash)(v);
/* Otherwise, the object can't be hashed */
- PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
- v->ob_type->tp_name);
- return -1;
+ return PyObject_HashNotImplemented(v);
}
PyObject *