]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-132762: Fix underallocation bug in `dict.fromkeys()`(gh-133627) (gh-133686)
authorSam Gross <colesbury@gmail.com>
Thu, 8 May 2025 17:40:05 +0000 (13:40 -0400)
committerGitHub <noreply@github.com>
Thu, 8 May 2025 17:40:05 +0000 (17:40 +0000)
commit6ab4a4a32c284ddf2af765e011f59de70ff31eb6
tree2a5706b0eec5fa877103cdff6d10cfdc7b0a7234
parent8e334f40b85b6fca564ce264c35ffb49e15520ba
[3.13] gh-132762: Fix underallocation bug in `dict.fromkeys()`(gh-133627) (gh-133686)

The function `dict_set_fromkeys()` adds elements of a set to an existing
dictionary. The size of the expanded dictionary was estimated with
`PySet_GET_SIZE(iterable)`, which did not take into account the size of the
existing dictionary.
(cherry picked from commit 421ba589d02b53131f793889d221ef3b1f1410a4)

Co-authored-by: Angela Liss <59097311+angela-tarantula@users.noreply.github.com>
Lib/test/test_dict.py
Misc/NEWS.d/next/Core and Builtins/2025-05-08-13-48-02.gh-issue-132762.tKbygC.rst [new file with mode: 0644]
Objects/dictobject.c