]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-132617: Fix `dict.update()` mutation check (gh-134815) (gh-135581)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 16 Jun 2025 17:19:58 +0000 (19:19 +0200)
committerGitHub <noreply@github.com>
Mon, 16 Jun 2025 17:19:58 +0000 (17:19 +0000)
commit15f7bd4295533c6debe3a5a898de7dcf97abc138
tree61769db53e6bc7f3942575e3f147f741311d10c7
parent027f58473cf1abda4c20cfc0852b4749c3a12932
[3.14] gh-132617: Fix `dict.update()` mutation check (gh-134815) (gh-135581)

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)

Co-authored-by: Sam Gross <colesbury@gmail.com>
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