GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [WIP] gh-141510: PEP 814: Add built-in frozendict type by vstinner · Pull Request #141508 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Nov 13, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Basic tests
  • Bare minimum documentation
  • Support frozendict in marshal, pickle, json, copy
  • Replace dict with frozendict in many stdlib modules

📚 Documentation preview 📚: https://cpython-previews--141508.org.readthedocs.build/

  • Issue: PEP 814: Add built-in frozendict type #141510

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

septatrix and GabrielHGobi reacted with thumbs up emoji kalvdans, leodevian, jonathanslenders, toth-dev, agriyakhetarpal, and chengfeng-xie reacted with rocket emoji
All reactions
  • 👍 2 reactions
  • 🚀 6 reactions
@vstinner @corona10 Marco Sulla
[WIP] PEP 814: Add built-in frozendict type
1637c04
* Basic tests
* Bare minimum documentation
* Support frozendict in marshal, pickle, json
* Replace dict with frozendict in many stdlib modules

Co-Authored-by: Donghee Na <[email protected]>
Co-Authored-by: Marco Sulla <[email protected]>
@vstinner vstinner added the skip news label Nov 13, 2025
vstinner added 2 commits November 13, 2025 14:21
@vstinner
Update Tools/build/generate_token.py for token.py
49aca48
@vstinner
Try to fix build on Ubuntu and macOS
3299299
@vstinner vstinner changed the title [WIP] PEP 814: Add built-in frozendict type [WIP] gh-141510: PEP 814: Add built-in frozendict type Nov 13, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Nov 13, 2025
PEP 814: Add built-in frozendict type #141510
Closed
@vstinner

vstinner commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

This PR was created mainly to play with PEP 814 implementation, not to be merged.

If PEP 814 is accepted, this PR should be splitted into smaller parts, easier to review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

mypy / Run mypy on Lib/_pyrepl (pull_request)
mypy / Run mypy on Lib/tomllib (pull_request)

mypy fails with Name "frozendict" is not defined.

hugovk reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Fix make check-c-globals
18ce520
@vstinner

vstinner commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

Tests / Android (x86_64) (pull_request) does crash, I'm not sure why.

  0:01:27 [ 39/497] test.test_concurrent_futures.test_interpreter_pool
  E/libsigchain: reverting to SIG_DFL handler for signal 11, ucontext 0x72d5b7547ac0
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

nineteendo
nineteendo reviewed Nov 13, 2025
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner and others added 2 commits November 13, 2025 16:24
@vstinner
Add PyFrozenDict_Type to static_types
1a72eec
@vstinner @nineteendo
Update Doc/library/stdtypes.rst
9d6ca58
Co-authored-by: Nice Zombies <[email protected]>
@vstinner vstinner mentioned this pull request Nov 13, 2025
PEP 814: Frozendict vstinner/cpython#14
Closed
@vstinner

vstinner commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

Tests / Android (x86_64) (pull_request) does crash, I'm not sure why.

It should be fixed by Add PyFrozenDict_Type to static_types commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner added 2 commits November 13, 2025 21:38
@vstinner
Replace PyDict_Check() with _PyAnyDict_Check()
439c98c
@vstinner
copy: support frozendict
4a1a504
eendebakpt
eendebakpt reviewed Nov 13, 2025
View reviewed changes
Comment thread Objects/dictobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner added 3 commits November 13, 2025 22:08
@vstinner
Fix frozendict.__reduce_ex__()
302767b
@vstinner
exec(): accept frozendict for globals
07b3510
@vstinner
Make PyAnyDict_Check() public
04f66ad
eendebakpt
eendebakpt reviewed Nov 13, 2025
View reviewed changes
Comment thread Lib/copy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner added 5 commits November 14, 2025 10:34
@vstinner
Optimize frozendict.copy()
6fca6d1
@vstinner
Fix frozendict merge ("|=" operator); add tests
6727967
@vstinner
copy: use _copy_atomic_types instead; add tests
d231cdb
@vstinner
frozendict
3a07c46
@vstinner
pprint supports frozendict
bc25bb2
sergey-miryanov
sergey-miryanov reviewed Nov 14, 2025
View reviewed changes
Comment thread Lib/json/tool.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
change json.tool._group_to_theme_color formatting
0acff5e
sergey-miryanov
sergey-miryanov reviewed Nov 14, 2025
View reviewed changes
Comment thread Modules/_json.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
json: use PyAnyDict_Check()
e90156e
sergey-miryanov
sergey-miryanov reviewed Nov 14, 2025
View reviewed changes
Comment thread Modules/_pickle.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
_pickle: fix refleak
fe7e7f5
sergey-miryanov
sergey-miryanov reviewed Nov 14, 2025
View reviewed changes
Comment thread Objects/dictobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

sergey-miryanov
sergey-miryanov reviewed Nov 14, 2025
View reviewed changes
Comment thread Objects/dictobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
frozendict_hash: use atomic load/store
4c5c8d2
kalvdans
kalvdans reviewed Nov 14, 2025
View reviewed changes
Comment thread Lib/pydoc_data/topics.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner and others added 2 commits November 14, 2025 23:20
@vstinner @kalvdans
Update Lib/pydoc_data/topics.py
0a57448
Co-authored-by: kalvdans <[email protected]>
@vstinner
Fix test_copy: remove duplicated test
fc66056
@vstinner

vstinner commented Dec 1, 2025

Copy link
Copy Markdown
Member Author

TODO: Provide better error on hashing a mutable value:

>>> fd = frozendict(x=[1])
>>> hash(fd)
...
TypeError: cannot use 'tuple' as a set element (unhashable type: 'list')
efimov-mikhail reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@albertedwardson albertedwardson mentioned this pull request Dec 5, 2025
http.client: Usage of mutable default headers={} in HTTPConnection.request #142279
Closed
@vstinner
frozendict | {} returns the same frozendict
c1f5055
Add GET_USED() macro.
nineteendo
nineteendo reviewed Dec 12, 2025
View reviewed changes
Comment thread Objects/dictobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner added 2 commits December 12, 2025 18:05
@vstinner
Fix frozendict_or()
6ff9c67
@vstinner
Moar frozendict|frozendict optimizations
9a64439
@danyeaw danyeaw mentioned this pull request Dec 23, 2025
Drop frozendict as a dependency conda/conda#15538
Open
2 tasks done
@vstinner

vstinner commented Feb 13, 2026

Copy link
Copy Markdown
Member Author

This PR is a draft combining all changes to adopt frozendict in the stdlib. It's too big to be merged. I started to split this PR into smaller PRs with #144757 as a starting point: most basic PR just to add the frozendict type.

sergey-miryanov, hugovk, nineteendo, and benediktjohannes reacted with hooray emoji
All reactions
  • 🎉 4 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@benediktjohannes

benediktjohannes commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

@vstinner is it purposed that this draft PR is linked in the documentation at „reference implementation“ in PEP 814? I know that this includes more than the other PR, but I think that it was probably better to link the real PRs with the real changes made because they include really every single change correctly rather than a draft, no?

griels reacted with thumbs up emoji griels reacted with thumbs down emoji
All reactions
  • 👍 1 reaction
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk

hugovk commented Feb 17, 2026

Copy link
Copy Markdown
Member

@benediktjohannes PEPs are historical documents (PEP 814 will soon have a banner to this effect), so it's fine for https://peps.python.org/pep-0814/#reference-implementation to point to this PR. It was the reference implementation at the time the PEP was written, discussed and accepted.

The real implementation is another matter, and is being committed in smaller PRs. We can follow along via the issue, #141510.

benediktjohannes reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@benediktjohannes

benediktjohannes commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Thanks!

hugovk and benediktjohannes reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eendebakpt eendebakpt mentioned this pull request Feb 17, 2026
gh-141510: Implement copy and deepcopy for frozendict #144905
Merged
@vstinner

vstinner commented Feb 17, 2026

Copy link
Copy Markdown
Member Author

I started to split this PR into smaller PRs with #144757 as a starting point: most basic PR just to add the frozendict type.

I created many PRs in #141510. This PR is no longer needed, I close it.

benediktjohannes reacted with thumbs up emoji hugovk reacted with rocket emoji
All reactions
  • 👍 1 reaction
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Feb 17, 2026
@vstinner
vstinner deleted the frozendict branch February 17, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sergey-miryanov sergey-miryanov sergey-miryanov left review comments
@eendebakpt eendebakpt eendebakpt left review comments
@JelleZijlstra JelleZijlstra Awaiting requested review from JelleZijlstra JelleZijlstra will be requested when the pull request is marked ready for review JelleZijlstra is a code owner
@AlexWaygood AlexWaygood Awaiting requested review from AlexWaygood AlexWaygood will be requested when the pull request is marked ready for review AlexWaygood is a code owner
@encukou encukou Awaiting requested review from encukou encukou will be requested when the pull request is marked ready for review encukou is a code owner
@hauntsaninja hauntsaninja Awaiting requested review from hauntsaninja hauntsaninja will be requested when the pull request is marked ready for review hauntsaninja is a code owner
@ethanfurman ethanfurman Awaiting requested review from ethanfurman ethanfurman will be requested when the pull request is marked ready for review ethanfurman is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner will be requested when the pull request is marked ready for review AA-Turner is a code owner
@gaogaotiantian gaogaotiantian Awaiting requested review from gaogaotiantian gaogaotiantian will be requested when the pull request is marked ready for review gaogaotiantian is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 will be requested when the pull request is marked ready for review tomasr8 is a code owner
@rhettinger rhettinger Awaiting requested review from rhettinger rhettinger will be requested when the pull request is marked ready for review rhettinger is a code owner
@pganssle pganssle Awaiting requested review from pganssle pganssle will be requested when the pull request is marked ready for review pganssle is a code owner
@StanFromIreland StanFromIreland Awaiting requested review from StanFromIreland StanFromIreland will be requested when the pull request is marked ready for review StanFromIreland is a code owner
@ericvsmith ericvsmith Awaiting requested review from ericvsmith ericvsmith will be requested when the pull request is marked ready for review ericvsmith is a code owner
@gpshead gpshead Awaiting requested review from gpshead gpshead will be requested when the pull request is marked ready for review gpshead is a code owner
@picnixz picnixz Awaiting requested review from picnixz picnixz will be requested when the pull request is marked ready for review picnixz is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently will be requested when the pull request is marked ready for review ericsnowcurrently is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon will be requested when the pull request is marked ready for review markshannon is a code owner
@ZeroIntensity ZeroIntensity Awaiting requested review from ZeroIntensity ZeroIntensity will be requested when the pull request is marked ready for review ZeroIntensity is a code owner
@methane methane Awaiting requested review from methane methane will be requested when the pull request is marked ready for review methane is a code owner
+3 more reviewers
@kalvdans kalvdans kalvdans left review comments
@Zaczero Zaczero Zaczero left review comments
@nineteendo nineteendo nineteendo left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@vstinner @benediktjohannes @hugovk @sergey-miryanov @eendebakpt @kalvdans @Zaczero @nineteendo
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.