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

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 794c1d1

Browse files
committed
Constant hash for _PyNone_Type
1 parent 51d1035 commit 794c1d1

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
981C
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