Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
atomic load
  • Loading branch information
mdboom committed Mar 25, 2025
commit 5faa68d6c8a33feb2e656fe787e769952c65e1e7
7 changes: 4 additions & 3 deletions Objects/tupleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,14 @@ tuple_hash(PyObject *op)
{
PyTupleObject *v = _PyTuple_CAST(op);

if (v->ob_hash != -1) {
return v->ob_hash;
Py_uhash_t acc = FT_ATOMIC_LOAD_SSIZE_RELAXED(v->ob_hash);
if (acc != (Py_uhash_t)-1) {
return acc;
}

Py_ssize_t len = Py_SIZE(v);
PyObject **item = v->ob_item;
Py_uhash_t acc = _PyTuple_HASH_XXPRIME_5;
acc = _PyTuple_HASH_XXPRIME_5;
for (Py_ssize_t i = 0; i < len; i++) {
Py_uhash_t lane = PyObject_Hash(item[i]);
if (lane == (Py_uhash_t)-1) {
Expand Down
Loading