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 — gh-141510: Use frozendict for errno.errorcode by vstinner · Pull Request #144906 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Feb 17, 2026 •
edited by github-actions Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: PEP 814: Add built-in frozendict type #141510

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-141510: Use frozendict for errno.errorcode
a4834a8
@bedevere-app bedevere-app Bot added the awaiting core review label Feb 17, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Feb 17, 2026
PEP 814: Add built-in frozendict type #141510
Closed
@vstinner

vstinner commented Feb 18, 2026

Copy link
Copy Markdown
Member Author

cc @Yhg1s

All reactions

Sorry, something went wrong.

Uh oh!

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

corona10
corona10 reviewed Feb 19, 2026
View reviewed changes
Comment thread Modules/errnomodule.c
add_errcode("ENOTCAPABLE", ENOTCAPABLE, "Capabilities insufficient");
#endif

PyObject *frozendict = PyFrozenDict_New(error_dict);

@corona10 corona10 Feb 19, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think that we have to add new C API for frozendict with builder pattern.
This is inefficient for many people.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Feb 19, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well, frozendict is not widely used in C code yet. IMO it's too early to design an optimized API to build a new frozendict object. PyFrozenDict_New() should be good for now.

Sorry, something went wrong.

Uh oh!

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

corona10 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Yhg1s

Yhg1s commented Feb 19, 2026

Copy link
Copy Markdown
Member

What's the rationale for using frozendict here? I don't think it's unreasonable at all for user/library code to want to add to errno.errorcode. We build the module contents from compile time constants, but we don't add any once the Python version is released. It's not at all unreasonable to want to add known errno values on older Python versions, or adding ones that weren't supported by the build environment.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Feb 19, 2026

Copy link
Copy Markdown
Member Author

Ah ok, in this case, I close my PR.

My rationale is that I wanted to disallow modifying existing error codes or adding new error codes. But you say that it's possible on purpose, so I prefer to close the PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner closed this Feb 19, 2026
@Yhg1s

Yhg1s commented Feb 19, 2026

Copy link
Copy Markdown
Member

Just to be clear: I'm not saying it's possible on purpose, just that I think it is a useful property even if it wasn't on purpose, and I do think we have to consider that people are using the mutability. That's the case for any existing, exposed dict: it may not make sense to mutate it, but maybe we just don't see the cases where it does make sense. We have to consider whether the change is worth the potential breakage, so I think we need a good, real-world reason to replace the dict with a frozendict, not just a theoretical, common-sense one.

vstinner 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.

@vstinner
vstinner deleted the frozendict_errno branch February 19, 2026 15:55
@vstinner vstinner mentioned this pull request Apr 7, 2026
gh-145478: Implement frozendict into functools.partial #145960
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@corona10 corona10 corona10 left review comments

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review

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.

3 participants

@vstinner @Yhg1s @corona10
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 01402503 — 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.