]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[gh-117657] _Py_MergeZeroLocalRefcount isn't loading ob_ref_shared with strong enough...
authorDino Viehland <dinoviehland@meta.com>
Fri, 19 Apr 2024 21:21:01 +0000 (14:21 -0700)
committerGitHub <noreply@github.com>
Fri, 19 Apr 2024 21:21:01 +0000 (14:21 -0700)
Use acquire for load of ob_ref_shared

Objects/object.c

index 214e7c5b567928fe8ee9864d8f9efca3ef59059c..73a1927263cdcbd72ab7779d79181bf9aa038c20 100644 (file)
@@ -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);