Skip to content

Commit

Permalink
[gh-117657] _Py_MergeZeroLocalRefcount isn't loading ob_ref_shared wi…
Browse files Browse the repository at this point in the history
…th strong enough semantics (#118111)

Use acquire for load of ob_ref_shared
  • Loading branch information
DinoV authored Apr 19, 2024
1 parent b624490 commit b45af00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ _Py_MergeZeroLocalRefcount(PyObject *op)
assert(op->ob_ref_local == 0);

_Py_atomic_store_uintptr_relaxed(&op->ob_tid, 0);
Py_ssize_t shared = _Py_atomic_load_ssize_relaxed(&op->ob_ref_shared);
Py_ssize_t shared = _Py_atomic_load_ssize_acquire(&op->ob_ref_shared);
if (shared == 0) {
// Fast-path: shared refcount is zero (including flags)
_Py_Dealloc(op);
Expand Down

0 comments on commit b45af00

Please sign in to comment.