summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authoryonillasky <yonillasky@users.noreply.github.com>2022-12-16 20:36:13 (GMT)
committerGitHub <noreply@github.com>2022-12-16 20:36:13 (GMT)
commit432117cd1f59c76d97da2eaff55a7d758301dbc7 (patch)
tree62042b1cb80bf26c7bf7dc3a216004943aa61808 /Objects/object.c
parenta5a7cea202d34ca699d9594d428ba527ef7ff2ce (diff)
downloadcpython-432117cd1f59c76d97da2eaff55a7d758301dbc7.zip
cpython-432117cd1f59c76d97da2eaff55a7d758301dbc7.tar.gz
cpython-432117cd1f59c76d97da2eaff55a7d758301dbc7.tar.bz2
gh-99540: Constant hash for _PyNone_Type to aid reproducibility (GH-99541)
Needed for ASLR builds of Python.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 687bd36..028b0ed 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1641,6 +1641,11 @@ none_bool(PyObject *v)
return 0;
}
+static Py_hash_t none_hash(PyObject *v)
+{
+ return 0xFCA86420;
+}
+
static PyNumberMethods none_as_number = {
0, /* nb_add */
0, /* nb_subtract */
@@ -1692,7 +1697,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 */