Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
With some changes of my own thrown in (e.g. backport of r58107).
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 978071b..bfb891c 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2127,13 +2127,6 @@
return dict_update_common(self, args, kwds, "dict");
}
-static long
-dict_nohash(PyObject *self)
-{
- PyErr_SetString(PyExc_TypeError, "dict objects are unhashable");
- return -1;
-}
-
static PyObject *
dict_iter(PyDictObject *dict)
{
@@ -2165,7 +2158,7 @@
0, /* tp_as_number */
&dict_as_sequence, /* tp_as_sequence */
&dict_as_mapping, /* tp_as_mapping */
- dict_nohash, /* tp_hash */
+ 0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */