https://github.com/python/cpython/commit/8a7146c5eb340aa5115a5baf61e4f74c589d440f
commit: 8a7146c5eb340aa5115a5baf61e4f74c589d440f
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: colesbury <[email protected]>
date: 2025-02-07T10:18:57-05:00
summary:

[3.13] gh-117657: Fix data race in `dict_dict_merge` (gh-129755) (gh-129808)

Found while running `test_load_attr_module` from `test_opcache` under TSan.
(cherry picked from commit 34379d0a593e5a76e2f754cdd7fccb79f25a4613)

Co-authored-by: Sam Gross <[email protected]>

files:
M Objects/dictobject.c

diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index ff16a41b9a5d4e..f947b44b039eb4 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -3713,7 +3713,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);
             mp->ma_version_tag = new_version;
             ASSERT_CONSISTENT(mp);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to