Skip to content

Commit cbe442b

Browse files
committed
Add __hash__ to tgl.Peer.
1 parent c2bb534 commit cbe442b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎python-types.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,12 @@ tgl_Peer_repr(tgl_Peer *self)
969969
return ret;
970970
}
971971

972+
int
973+
tgl_Peer_hash(PyObject *self)
974+
{
975+
return PyObject_Hash(PyObject_GetAttrString(self, "id"));
976+
}
977+
972978
PyObject *
973979
tgl_Peer_RichCompare(PyObject *self, PyObject *other, int cmp)
974980
{
@@ -1016,7 +1022,7 @@ PyTypeObject tgl_PeerType = {
10161022
0, /* tp_as_number */
10171023
0, /* tp_as_sequence */
10181024
0, /* tp_as_mapping */
1019-
0, /* tp_hash */
1025+
(hashfunc)tgl_Peer_hash, /* tp_hash */
10201026
0, /* tp_call */
10211027
0, /* tp_str */
10221028
0, /* tp_getattro */

0 commit comments

Comments
 (0)