8000 Constant hash for _PyNone_Type · python/cpython@e791f7a · GitHub
[go: up one dir, main page]

Skip to content

Commit e791f7a

Browse files
committed
Constant hash for _PyNone_Type
1 parent e37744f commit e791f7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Objects/object.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,6 +1638,11 @@ none_bool(PyObject *v)
16381638
return 0;
16391639
}
16401640

1641+
static Py_hash_t none_hash(PyObject *v)
1642+
{
1643+
return 0xBADCAB1E;
1644+
}
1645+
16411646
static PyNumberMethods none_as_number = {
16421647
0, /* nb_add */
16431648
0, /* nb_subtract */
@@ -1689,7 +1694,7 @@ PyTypeObject _PyNone_Type = {
16891694
&none_as_number, /*tp_as_number*/
16901695
0, /*tp_as_sequence*/
16911696
0, /*tp_as_mapping*/
1692-
0, /*tp_hash */
1697+
(hashfunc)none_hash, /* tp_hash */
16931698
0, /*tp_call */
16941699
0, /*tp_str */
16951700
0, /*tp_getattro */

0 commit comments

Comments
 (0)
0