From: Sam Gross Date: Fri, 7 Feb 2025 14:44:24 +0000 (-0500) Subject: gh-117657: Fix data race in `dict_dict_merge` (gh-129755) X-Git-Tag: v3.14.0a5~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=34379d0a593e5a76e2f754cdd7fccb79f25a4613;p=thirdparty%2FPython%2Fcpython.git gh-117657: Fix data race in `dict_dict_merge` (gh-129755) Found while running `test_load_attr_module` from `test_opcache` under TSan. --- diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 91cf013a1dc2..d979cd72b48e 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -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);