]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117657: Fix data race in `dict_dict_merge` (gh-129755)
authorSam Gross <colesbury@gmail.com>
Fri, 7 Feb 2025 14:44:24 +0000 (09:44 -0500)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2025 14:44:24 +0000 (09:44 -0500)
Found while running `test_load_attr_module` from `test_opcache` under TSan.

Objects/dictobject.c

index 91cf013a1dc24ba4c3b39e2bb6122e884eefd27e..d979cd72b48e690f89ad7bb65cc391e16876a028 100644 (file)
@@ -3793,7 +3793,7 @@ dict_dict_merge(PyInterpreterState *interp, PyDictObject *mp, PyDictObject *othe
 
             ensure_shared_on_resize(mp);
             dictkeys_decref(interp, mp->ma_keys, IS_DICT_SHARED(mp));
-            mp->ma_keys = keys;
+            set_keys(mp, keys);
             STORE_USED(mp, other->ma_used);
             ASSERT_CONSISTENT(mp);