diff --git a/Objects/object.c b/Objects/object.c index 9303086..15640f4 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2006,6 +2006,12 @@ none_dealloc(PyObject* ignore) Py_FatalError("deallocating None"); } +/* make hash(None) portable */ +static long +none_hash(PyObject* p) +{ + /* (78 << 24) + (111 << 16) + (110 << 8) + 101 */ + return 1315925605; +} static PyTypeObject PyNone_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) @@ -2021,7 +2028,7 @@ static PyTypeObject PyNone_Type = { 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ - (hashfunc)_Py_HashPointer, /*tp_hash */ + none_hash, /*tp_hash */ }; PyObject _Py_NoneStruct = {