Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit432117c

Browse files
authored
gh-99540: Constant hash for _PyNone_Type to aid reproducibility (GH-99541)
Needed for ASLR builds of Python.
1 parenta5a7cea commit432117c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``None`` now hashes to a constant value. This is not a requirements change.

‎Objects/object.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,11 @@ none_bool(PyObject *v)
16411641
return0;
16421642
}
16431643

1644+
staticPy_hash_tnone_hash(PyObject*v)
1645+
{
1646+
return0xFCA86420;
1647+
}
1648+
16441649
staticPyNumberMethodsnone_as_number= {
16451650
0,/* nb_add */
16461651
0,/* nb_subtract */
@@ -1692,7 +1697,7 @@ PyTypeObject _PyNone_Type = {
16921697
&none_as_number,/*tp_as_number*/
16931698
0,/*tp_as_sequence*/
16941699
0,/*tp_as_mapping*/
1695-
0,/*tp_hash */
1700+
(hashfunc)none_hash,/*tp_hash */
16961701
0,/*tp_call */
16971702
0,/*tp_str */
16981703
0,/*tp_getattro */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp