]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-132617: Fix `dict.update()` mutation check (gh-134815) (gh-135582)
authorSam Gross <colesbury@gmail.com>
Mon, 16 Jun 2025 17:30:52 +0000 (13:30 -0400)
committerGitHub <noreply@github.com>
Mon, 16 Jun 2025 17:30:52 +0000 (17:30 +0000)
commitf33a5e891a03df416dde7afa7e3bfb2ac800f5a4
treee51fae504a340ce6680173d7e81c4c6658bb7911
parent404e8aa9f370491ef5918d618f8f9a7529183981
[3.13] gh-132617: Fix `dict.update()` mutation check (gh-134815) (gh-135582)

Use `ma_used` instead of `ma_keys->dk_nentries` for modification check
so that we only check if the dictionary is modified, not if new keys are
added to a different dictionary that shared the same keys object.
(cherry picked from commit d8994b0a77cc9821772d05db00a6ab23382fa17d)
Lib/test/test_dict.py
Misc/NEWS.d/next/Core and Builtins/2025-05-27-20-29-00.gh-issue-132617.EmUfQQ.rst [new file with mode: 0644]
Objects/dictobject.c