Skip to content

Support packing Python 3.15 frozentdict (PEP 814) - #738

Open
edgarrmondragon wants to merge 1 commit into
msgpack:mainfrom
edgarrmondragon:frozendict
Open

Support packing Python 3.15 frozentdict (PEP 814)#738
edgarrmondragon wants to merge 1 commit into
msgpack:mainfrom
edgarrmondragon:frozendict

Conversation

@edgarrmondragon

@edgarrmondragon edgarrmondragon commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Support packing a Python 3.15 frozendict.

This PR doesn't support unpacking into a frozendict other than with the generic object_pairs_hook=frozendict.

@edgarrmondragon
edgarrmondragon marked this pull request as ready for review August 31, 2026 16:43
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The hook test checks the input type instead of the unpacked result, leaving the documented behavior unverified.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds Python 3.15 frozendict packing support across both packer implementations.

Changes:

  • Recognizes frozendict as a MessagePack map.
  • Supports strict type handling.
  • Adds packing and hook-based unpacking tests.
File summaries
File Description
msgpack/fallback.py Adds fallback packer support.
msgpack/_packer.pyx Adds C packer support.
test/test_pack.py Tests frozendict round trips.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/test_pack.py
assert unpacked == fd

unpacked = unpackb(packb(fd), use_list=1, object_pairs_hook=builtins.frozendict)
assert isinstance(fd, builtins.frozendict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants