Repository navigation
Closed
3 / 43 of 4 issues completedLabels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
Issue created to track the implementation of https://peps.python.org/pep-0814/.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- [WIP] gh-141510: PEP 814: Add built-in frozendict type #141508
- gh-141510, PEP 814: Add built-in frozendict type #144757
- gh-141510, PEP 814: Add frozendict support to json #144903
- gh-141510: Replace MappingProxyType with frozendict #144904
- gh-141510: Implement copy and deepcopy for frozendict #144905
- gh-141510: Use frozendict for errno.errorcode #144906
- gh-141510: Run regen-test-frozenmain for frozendict #144907
- gh-141510: Support frozendict in pprint #144908
- gh-141510: Use frozendict in the stdlib #144909
- gh-141510: Use frozendict in the _opcode_metadata #144910
- gh-141510: Update specializer to support frozendict with BINARY_SUBSCR #144911
- gh-141510: Add frozendict fast-path to the set type #144912
- gh-141510: Update mp_length of frozendict to use non atomic operation #144913
- gh-141510: Optimize {frozen}dict.fromkeys for frozendict #144915
- gh-141510: Optimize hash(frozendict) #144919
- gh-141510: Remove unncessary lock holding for frozendict repr #144920
- gh-141510: Change repr(frozendict) for empty dict #144921
- gh-141510: Fix
test_xpicklefailing with introduction offrozendict#144927 - gh-141510: Mention frozendict in dict documentation #144934
- gh-141510, PEP 814: Add frozendict support to pickle #144936
- gh-141510: Add frozendict_check_mutable() #144944
- gh-141510: Fix frozendict.fromkeys() for subclasses #144947
- gh-141510: Update specializer to support frozendict #144949
- gh-141510: Fix frozendict.fromkeys() for subclasses #144952
- gh-141510: Add can_modify_dict() in dictobject.c #144955
- gh-141510: Update Whats News for frozendict #144961
- gh-141510: Fix frozendict.fromkeys() for dict subclasses #144962
- gh-141510, PEP 814: Add frozendict support to pickle #144967
- gh-141510: Update ftscalingbench to support frozendict #144999
- gh-141510: Document ParameterizedMIMEHeader.params change #145003
- gh-141510: Fix copy.deepcopy() for recursive frozendict #145027
- gh-145122: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict #145039
- gh-141510: Fix test_xpickle for Python 3.14 and older #145069
- gh-141510: Test frozendict C API #145081
- gh-141510: Check argument in PyDict_MergeFromSeq2() #145082
- gh-141510: Check argument in PyDict_Contains() #145083
- gh-141510: Test frozendict in test_capi.test_dict #145084
- gh-141510: Change dict_unhashable_type() error message for frozendict #145085
- gh-141510: support frozendict's in the C decimal module #145165
- gh-141510: Update PyDict_Copy documentation with note on frozendict #145249
- gh-141510: Return frozendict unmodified in PyDict_Copy() #145505
- gh-141510: Optimize PyDict_Copy() for frozendict #145509
- gh-141510: Add frozendict support to python-gdb.py #145511
- gh-141510: Always return a dict in PyDict_Copy() #145517
- gh-141510: Don't accept frozendict in PyDict_Watch() #145529
- gh-141510: Add PyAnyDict_AsNewDict() function #145531
- gh-141510: Update PyDict C API doc for frozendict #145533
- gh-141510: Fix frozendict.items() ^ frozendict.items() #145535
- gh-141510: Complete What's New in Python 3.15 for frozendict #145537
- gh-141510: No longer accept frozendict in PyDict_Copy() #145542
- gh-141510: Change marshal version to 6 #145551
- gh-141510: Raise TypeError in PyDict_SetItem() on frozendict #145564
- gh-141510: Support
frozendictinplistlib#145590 - gh-141510: Optimize frozendict(frozendict) #145592
- gh-141510: Avoid critical section on frozendict copy #145920
- gh-141510: Document isinstance change for frozendict in What's New #146107
- gh-141510 Update mapping methods in abstract.c to accept frozendict #150692
- gh-141510 Document and test frozendict class matching behaviour #150799
- [3.15] gh-141510 Document and test frozendict class matching behaviour (GH-150799) #151701
- [3.15] gh-141510 Add frozendict fast paths to abstract.c (GH-150692) #151704
- gh-141510: Update
marshalmodule comment withfrozendictsupport #153655 - [3.15] gh-141510: Update
marshalmodule comment withfrozendictsupport (GH-153655) #153681 - gh-141510: Document frozendict support in json #155929
- [3.15] gh-141510: Document frozendict support in json (gh-155929) #155933
Reacted by kalvdans, Chengfeng Xie, Triang-jyed-driung and Piotr Karmelita
Metadata
Metadata
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Activity
gh-141510: Avoid critical section on frozendict copy (#145920)
luckydonald commentedon Mar 18, 2026
Short question - I appologize if this is the wrong place for this, please kindly point me where it would be better.
Do I now have to write instead of
isinstance(somevar, dict)now?So do I write
isinstance(somevar, (dict, frozendict))both every time I want something to support reading json-like data?Is there a shared base I can easily check?
Or is
dictnow a subtype offrozendict, so checking that is enough, still? (After all it reads like dict now is like frozendict, just with update methods)vstinner commentedon Mar 18, 2026
isinstance(somevar, (dict, frozendict))is the correct check, yes. The common case class between dict and frozendict is object which is not helpful here.luckydonald commentedon Mar 18, 2026
Thanks a lot for your answer.
This feels like quite the change for every library on pypi which currently supports reading from dicts (e.g. config) needing to be updated to support both?
There is no similar approach as
Iterablefortuple, list, isn't there?Like
or similar?
From what I read
TypedDictwould also not be compatible, and creating an alternative is not part of this python release?entwanne commentedon Mar 18, 2026
There is the
Mappingabstract class incollections.abcif you want to recognize both (and also other mapping types such asmappingproxy).pythongh-141510: Document isinstance change for frozendict in What's New
vstinner commentedon Mar 18, 2026
The
isinstance(arg, dict)question has been asked multiple times, so I wrote PR gh-146107 to write solutions in the documentation.gh-141510: Document isinstance change for frozendict in What's New (#…
vstinner commentedon Mar 21, 2026
I close the issue again, even if they are still two open pull requests. The main feature (adding frozendict type) is done. Thanks everyone who has been involved in this heavy work!
gh-141510: Support `frozendict` in `plistlib` (#145590)
pythongh-141510: Support `frozendict` in `plistlib` (python#145590)
pythongh-141510, PEP 814: Add built-in frozendict type (python#144757)
pythongh-141510: Update mp_length of frozendict to use non atomic ope…
pythongh-141510: Remove unncessary lock holding for frozendict repr (p…
pythongh-141510: Optimize hash(frozendict) (python#144919)
pythongh-141510: Change repr(frozendict) for empty dict (python#144921)
pythongh-141510: Update `test_xpickle` for `frozendict` (python#144927)
pythongh-141510: Optimize {frozen}dict.fromkeys for frozendict (pytho…
pythongh-141510: Mention frozendict in dict documentation (python#144934
pythongh-141510: Implement copy and deepcopy for frozendict (python#1…
pythongh-141510: Add frozendict fast-path to the set type (python#144912
pythongh-141510: Add can_modify_dict() in dictobject.c (python#144955)
pythongh-141510: Fix frozendict.fromkeys() for subclasses (python#144952
pythongh-141510: Update specializer to support frozendict (pythongh-1…
pythongh-141510: Fix frozendict.fromkeys() for dict subclasses (pytho…
pythongh-141510: Replace MappingProxyType with frozendict (python#144904
pythongh-141510: Update Whats News for frozendict (pythongh-144961)
pythongh-141510: Update ftscalingbench to support frozendict (pythong…
pythongh-141510: Document ParameterizedMIMEHeader.params change (pyth…
pythongh-141510, PEP 814: Add frozendict support to pickle (python#14…
pythongh-141510, PEP 814: Add frozendict support to json (python#144903)
pythongh-141510: Fix test_xpickle for Python 3.14 and older (python#1…
pythongh-141510: Fix copy.deepcopy() for recursive frozendict (python…
pythongh-141510: Test frozendict C API (python#145081)
pythongh-141510: Support frozendict in pprint (python#144908)
pythongh-141510: Check argument in PyDict_MergeFromSeq2() (python#145082
pythongh-141510: Check argument in PyDict_Contains() (python#145083)
pythongh-141510: Test frozendict in test_capi.test_dict (python#145084)
pythongh-141510: Change dict_unhashable_type() error message for froz…
pythongh-141510: Update `PyDict_Copy` documentation with note on `fro…
pythongh-141510: support frozendict's in the C decimal module (python…
pythongh-141510: Return frozendict unmodified in PyDict_Copy() (pytho…
pythongh-141510: Optimize PyDict_Copy() for frozendict (python#145509)
pythongh-141510: Add frozendict support to python-gdb.py (python#145511)
pythongh-141510: Don't accept frozendict in PyDict_Watch() (python#14…
pythongh-141510: Use frozendict in the _opcode_metadata (python#144910)
pythongh-141510: Fix frozendict.items() ^ frozendict.items() (python#…
pythongh-141510: No longer accept frozendict in PyDict_Copy() (python…
pythongh-141510: Complete What's New in Python 3.15 for frozendict (p…
pythongh-141510: Change marshal version to 6 (python#145551)
pythongh-141510: Use frozendict in the stdlib (python#144909)
pythongh-141510: Optimize frozendict(frozendict) (python#145592)
pythongh-141510: Raise TypeError in PyDict_SetItem() on frozendict (p…
pythongh-141510: Update PyDict C API doc for frozendict (python#145533)
pythongh-141510: Avoid critical section on frozendict copy (python#14…
pythongh-141510: Document isinstance change for frozendict in What's …
pythongh-141510: Support `frozendict` in `plistlib` (python#145590)
da-woods commentedon Jun 16, 2026
I attached a couple of PRs to this (which maybe I should have created new issues for in hindsight...). The more important of them is probably #150799 (which documents and tests their
_Py_TPFLAGS_MATCH_SELFbehaviourgh-141510 Document and test frozendict class matching behaviour (#150799
gh-141510 Add frozendict fast paths to abstract.c (#150692)
[3.15] gh-141510 Document and test frozendict class matching behaviour (
[3.15] gh-141510 Add frozendict fast paths to abstract.c (GH-150692) (#…
pythongh-141510 Document and test frozendict class matching behaviour (…
pythongh-141510 Add frozendict fast paths to abstract.c (python#150692)
gh-141510: Update `marshal` module comment with `frozendict` support (#…
[3.15] gh-141510: Update `marshal` module comment with `frozendict` s…
gh-141510: Document frozendict support in json (gh-155929)
[3.15] gh-141510: Document frozendict support in json (gh-155929) (#1…