Skip to content

Commit 4c5c8d2

Browse files
committed
frozendict_hash: use atomic load/store
1 parent fe7e7f5 commit 4c5c8d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/dictobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7878,7 +7878,7 @@ static Py_hash_t
78787878
frozendict_hash(PyObject *op)
78797879
{
78807880
PyFrozenDictObject *self = _PyFrozenDictObject_CAST(op);
7881-
Py_hash_t hash = self->ma_hash;
7881+
Py_hash_t hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(self->ma_hash);
78827882
if (hash != -1) {
78837883
return hash;
78847884
}
@@ -7899,7 +7899,7 @@ frozendict_hash(PyObject *op)
78997899
return -1;
79007900
}
79017901

7902-
self->ma_hash = hash;
7902+
FT_ATOMIC_STORE_SSIZE_RELAXED(self->ma_hash, hash);
79037903
return hash;
79047904
}
79057905

0 commit comments

Comments
 (0)