Skip to content

gh-141510: Use frozendict in the stdlib#144909

Open
vstinner wants to merge 2 commits intopython:mainfrom
vstinner:frozendict_stdlib
Open

gh-141510: Use frozendict in the stdlib#144909
vstinner wants to merge 2 commits intopython:mainfrom
vstinner:frozendict_stdlib

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Feb 17, 2026

Co-authored-by: Donghee Na <donghee.na@python.org>
@vstinner
Copy link
Member Author

This PR only changes private names, so it should not impact stdlib users.

@vstinner
Copy link
Member Author

If this change is merged, I will propose a follow-up PR which modify public names.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

One optional suggestion in typing.py

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

Ok for ssl and a suggestion for opcode

_cache_format = {
"LOAD_GLOBAL": {
_cache_format = frozendict(
LOAD_GLOBAL={
Copy link
Member

Choose a reason for hiding this comment

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

The values of LOAD_GLOBAL can also be a frozendict (that is, we can have nested frozendicts).

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

@corona10
Copy link
Member

The SC does not allow mechanically replacing all uses of dict. Please wait for reviews from the code owners of each module.

@JelleZijlstra
Copy link
Member

What's the benefit of changing this in e.g. typing.py? It might break some users who modify this dict. That's not a supported use case, but we shouldn't go out of our way to break users unless there's some benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants