]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-141510: Add can_modify_dict() in dictobject.c (#144955)
authorVictor Stinner <vstinner@python.org>
Wed, 18 Feb 2026 14:47:49 +0000 (15:47 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Feb 2026 14:47:49 +0000 (15:47 +0100)
commit1ddb41268997938d5f416e1ac98ae39cc3e81535
treeaef22557bda17db2f213c20b879aa5f7a0259d9c
parentf705486745e5907190f1ace76fd08f492be09e68
gh-141510: Add can_modify_dict() in dictobject.c (#144955)

can_modify_dict() is stricter than ASSERT_DICT_LOCKED() for
frozendict. It uses PyUnstable_Object_IsUniquelyReferenced() which
matters for free-threaded builds.

Replace anydict_setitem_take2() with setitem_take2_lock_held(). It's
no longer useful to have two functions.
Objects/dictobject.c