◐ Shell
reader mode source ↗
Skip to content

gh-145119: Allow frozendict to be assigned to instance __dict__#145123

Closed
mohsinm-dev wants to merge 2 commits into
python:mainfrom
mohsinm-dev:gh-145119-frozendict-instance-dict
Closed

gh-145119: Allow frozendict to be assigned to instance __dict__#145123
mohsinm-dev wants to merge 2 commits into
python:mainfrom
mohsinm-dev:gh-145119-frozendict-instance-dict

Conversation

@mohsinm-dev

@mohsinm-dev mohsinm-dev commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Allow frozendict (and its subclasses) to be assigned to an instance's __dict__, enabling immutable instances.

Changes:

  • _PyObject_SetDict: accept frozendict via PyAnyDict_Check
  • _PyDict_SetItem_LockHeld: raise TypeError on set/delete instead of SystemError
  • object___dir___impl: convert frozendict to a mutable dict for merging

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hide comment

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b702cf72b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mohsinm-dev mohsinm-dev force-pushed the gh-145119-frozendict-instance-dict branch from 6b702cf to 8d6ec8d Compare February 22, 2026 19:22
@skirpichev

Copy link
Copy Markdown
Member

In order to keep the commit history intact, please avoid squashing or amending history and then force-pushing to the PR. Reviewers often want to look at individual commits. When the PR is merged, everything will be squashed into a single commit.

@vstinner

vstinner commented Mar 5, 2026

Copy link
Copy Markdown
Member

_PyDict_SetItem_LockHeld: raise TypeError on set/delete instead of SystemError

I extracted these changes from your PR and created a new PR based on it: PR gh-145564.

@StanFromIreland

Copy link
Copy Markdown
Member

The attached issue was closed.

@mohsinm-dev mohsinm-dev deleted the gh-145119-frozendict-instance-dict branch March 9, 2026 01:30
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.

4 participants