Skip to content

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

Merged
methane merged 4 commits into
msgpack:mainfrom
edgarrmondragon:frozendict
Sep 2, 2026
Merged

Support packing Python 3.15 frozentdict (PEP 814)#738
methane merged 4 commits 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 Outdated
edgarrmondragon and others added 2 commits September 1, 2026 08:06
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@edgarrmondragon

edgarrmondragon commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

0d3fce6 is slightly slower (~2%) than the previous isinstance/type is approach, but using the macros seems cleaner to me πŸ™‚ . Happy to revert though.

@methane

methane commented Sep 2, 2026

Copy link
Copy Markdown
Member

Update Cython to 3.3 and use PyAnyDict_Check and PyAnyDict_CheckExact.

…xact`

Signed-off-by: Edgar RamΓ­rez MondragΓ³n <edgarrm358@gmail.com>
@edgarrmondragon

Copy link
Copy Markdown
Contributor Author

Update Cython to 3.3 and use PyAnyDict_Check and PyAnyDict_CheckExact.

PTAL 220921e

@methane
methane requested a balanced review from Copilot September 2, 2026 16:17

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.

🟒 Approval recommended

Both implementations preserve strict-type semantics and are covered by Python 3.15 tests.

Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@methane
methane merged commit 7a63920 into msgpack:main Sep 2, 2026
51 checks passed
@methane

methane commented Sep 2, 2026

Copy link
Copy Markdown
Member

thanks.

@edgarrmondragon
edgarrmondragon deleted the frozendict branch September 2, 2026 16:25
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