Commit cbe442b7 authored by Vincent Castellano's avatar Vincent Castellano

Add __hash__ to tgl.Peer.

parent c2bb5346
...@@ -969,6 +969,12 @@ tgl_Peer_repr(tgl_Peer *self) ...@@ -969,6 +969,12 @@ tgl_Peer_repr(tgl_Peer *self)
return ret; return ret;
} }
int
tgl_Peer_hash(PyObject *self)
{
return PyObject_Hash(PyObject_GetAttrString(self, "id"));
}
PyObject * PyObject *
tgl_Peer_RichCompare(PyObject *self, PyObject *other, int cmp) tgl_Peer_RichCompare(PyObject *self, PyObject *other, int cmp)
{ {
...@@ -1016,7 +1022,7 @@ PyTypeObject tgl_PeerType = { ...@@ -1016,7 +1022,7 @@ PyTypeObject tgl_PeerType = {
0, /* tp_as_number */ 0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
0, /* tp_hash */ (hashfunc)tgl_Peer_hash, /* tp_hash */
0, /* tp_call */ 0, /* tp_call */
0, /* tp_str */ 0, /* tp_str */
0, /* tp_getattro */ 0, /* tp_getattro */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment