Skip to content

Accept frozendict in marshal and ElementTree.Element on 3.15 - #16933

Merged
srittau merged 2 commits into
python:mainfrom
lvuping:marshal-etree-frozendict
Dec 1, 2026
Merged

srittau merged 2 commits into
python:mainfrom
lvuping:marshal-etree-frozendict

Conversation

@lvuping

@lvuping lvuping commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Python 3.15 lists marshal and xml.etree.ElementTree among the modules updated to accept frozendict (What's New). This adds it to the marshallable types and to the attrib parameter of Element(); makeelement() and SubElement() stay as they are because the C accelerator still rejects a frozendict there.

Prepared with Claude Code (Claude Opus 5.5). The follow-up change was prepared with OpenAI Codex.

Assisted-by: Claude Code (Claude Opus 5.5)
Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:02

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

This comment has been minimized.

Use the builtins module in the 3.15 branches so Ruff can resolve the type without version-specific imports.

Assisted-by: OpenAI Codex
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@@ -1,3 +1,4 @@
import builtins

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same question as before: Do we need to import builtins?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The import is there for Ruff. I tried using plain frozendict in both 3.15 branches. Ruff 0.16.10 flags it as an undefined name in both Element.__init__ and the marshal type alias under the repository’s configuration. Both files pass with builtins.frozendict. Python 3.15 itself can resolve the name directly.

@srittau
srittau merged commit 768df7b into python:main Dec 1, 2026
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants