We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 405daf5 commit 2f381f5Copy full SHA for 2f381f5
1 file changed
Modules/_decimal/_decimal.c
@@ -5935,11 +5935,13 @@ static Py_hash_t
5935
dec_hash(PyObject *op)
5936
{
5937
PyDecObject *self = _PyDecObject_CAST(op);
5938
- if (self->hash == -1) {
5939
- self->hash = _dec_hash(self);
5940
- }
+ Py_hash_t hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(self->hash);
5941
5942
- return self->hash;
+ if (hash == -1) {
+ hash = _dec_hash(self);
+ FT_ATOMIC_STORE_SSIZE_RELAXED(self->hash, hash);
5943
+ }
5944
+ return hash;
5945
}
5946
5947
/*[clinic input]
0 commit comments