Skip to content

gh-141510: Fix frozendict.fromkeys() for subclasses - #144952

Merged
vstinner merged 6 commits into
python:mainfrom
vstinner:frozendict_fromkeys_copy
Feb 18, 2026
Merged

vstinner merged 6 commits into
python:mainfrom
vstinner:frozendict_fromkeys_copy

Conversation

@vstinner

@vstinner vstinner commented Feb 18, 2026 •

Copy link
Copy Markdown
Member

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this option better

Comment thread Objects/dictobject.c Resolved
Comment thread Lib/test/test_dict.py Resolved
Comment thread Lib/test/test_dict.py Resolved
Comment thread Lib/test/test_dict.py Resolved
Comment thread Lib/test/test_dict.py Resolved
@vstinner

Copy link
Copy Markdown
Member Author

@corona10: I updated the test to apply your suggestions. Please review the updated PR.

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@vstinner
vstinner enabled auto-merge (squash) February 18, 2026 15:37
@vstinner
vstinner merged commit c582ff3 into python:main Feb 18, 2026
41 checks passed
@vstinner
vstinner deleted the frozendict_fromkeys_copy branch February 18, 2026 15:56
@vstinner

Copy link
Copy Markdown
Member Author

A case is not covered by this fix: a dict subclass which returns a frozendict! I wrote #144962 to fix this weird case.

brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants