gh-145118: Add frozendict support to type()#145124
Open
StanFromIreland wants to merge 2 commits intopython:mainfrom
Open
gh-145118: Add frozendict support to type()#145124StanFromIreland wants to merge 2 commits intopython:mainfrom
frozendict support to type()#145124StanFromIreland wants to merge 2 commits intopython:mainfrom
Conversation
eendebakpt
reviewed
Feb 22, 2026
| if (dict == NULL) { | ||
| goto error; | ||
| PyObject *dict; | ||
| if (PyFrozenDict_Check(ctx->orig_dict)) { |
Contributor
There was a problem hiding this comment.
Note: this code path is needed because PyDict_Copy would return a frozendict, see
Line 4257 in fd01372
eendebakpt
reviewed
Feb 22, 2026
| } | ||
| if (!PyAnyDict_Check(orig_dict)) { | ||
| PyErr_Format(PyExc_TypeError, | ||
| "type.__new__() argument 3 must be dict, not %T", |
Contributor
There was a problem hiding this comment.
Suggested change
| "type.__new__() argument 3 must be dict, not %T", | |
| "type.__new__() argument 3 must be dict or frozendict, not %T", |
For consideration, not sure I would make the change myself.
(and whatever the outcome: be consistent with maketrans below)
Member
Author
There was a problem hiding this comment.
Other error messages weren't updated like this, no?
vstinner
reviewed
Feb 22, 2026
Member
vstinner
left a comment
There was a problem hiding this comment.
You should write a separated PR to modify str.maketrans(). It's unrelated to the type change.
frozendict support to str.maketrans() and type()frozendict support to type()
Member
Author
|
Split to #145129. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Uh oh!
There was an error while loading. Please reload this page.