Skip to content

Commit

Permalink
Constant hash for _PyNone_Type
Browse files Browse the repository at this point in the history
  • Loading branch information
yonillasky committed Nov 16, 2022
1 parent 51d1035 commit 794c1d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,11 @@ none_bool(PyObject *v)
return 0;
}

static Py_hash_t none_hash(PyObject *v)
{
return 0xBADCAB1E;
}

static PyNumberMethods none_as_number = {
0, /* nb_add */
0, /* nb_subtract */
Expand Down Expand Up @@ -1689,7 +1694,7 @@ PyTypeObject _PyNone_Type = {
&none_as_number, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
(hashfunc)none_hash, /* tp_hash */
0, /*tp_call */
0, /*tp_str */
0, /*tp_getattro */
Expand Down

0 comments on commit 794c1d1

Please sign in to comment.