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/setobject.c b/Objects/setobject.c
index 3cbcd9e..b049d09 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -789,13 +789,6 @@
return hash;
}
-static long
-set_nohash(PyObject *self)
-{
- PyErr_SetString(PyExc_TypeError, "set objects are unhashable");
- return -1;
-}
-
/***** Set iterator type ***********************************************/
typedef struct {
@@ -2012,7 +2005,7 @@
&set_as_number, /* tp_as_number */
&set_as_sequence, /* tp_as_sequence */
0, /* tp_as_mapping */
- set_nohash, /* tp_hash */
+ 0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */