Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Avoid reacquiring the source dictionary lock when copying a sparse dictionary
in the free-threaded build.
9 changes: 8 additions & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,14 @@ copy_lock_held_untracked(PyObject *o, int as_frozendict)
}
if (copy == NULL)
return NULL;
if (dict_merge(copy, o, 1, NULL) < 0) {
int res;
if (!PyFrozenDict_Check(o) && Py_TYPE(mp)->tp_iter == dict_iter) {
res = dict_dict_merge((PyDictObject *)copy, mp, 1, NULL);
}
else {
res = dict_merge(copy, o, 1, NULL);
}
if (res < 0) {
Py_DECREF(copy);
return NULL;
}
Expand Down
Loading