Add Python marshal operations - #2719
Open
cnotin wants to merge 1 commit into
Open
Conversation
cnotin
force-pushed
the
agent/python-marshal-support
branch
2 times, most recently
from
August 7, 2026 22:55
af0ea8a to
7cf59c8
Compare
cnotin
force-pushed
the
agent/python-marshal-support
branch
from
August 7, 2026 23:11
7cf59c8 to
95313d7
Compare
cnotin
marked this pull request as ready for review
August 7, 2026 23:17
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.
Description
Adds client-side Python marshal encode/decode operations for JSON-compatible CPython format 4 values. Byte strings and integers beyond JavaScript's safe range use explicit tagged JSON representations.
The issue suggested the
py-marshalnpm package. It was deliberately not adopted: its last release was in 2020, its reader lacks several values needed here (including arbitrary-size integers, sets, Unicode/ASCII marshal string variants, and modern reference flags), and its NodeBuffer-oriented implementation is unsuitable as a dependable browser-side codec. The new dependency-free codec covers the documented JSON-compatible scope while keeping the operation client-side. It intentionally does not support version-specific Python code objects or other Python-only values that cannot be represented faithfully as JSON.Existing Issue
Closes #1041.
Screenshots
AI disclosure
This change was created with OpenAI Codex. The implementation, dependency assessment, and tests were generated with its assistance and then validated with CPython 3.14.4 and the full CyberChef test suite.
Test Coverage
Added CPython-generated format 4 fixtures covering null, booleans, integers, floats, strings, byte strings, lists, tuples, sets, and string-keyed dictionaries, plus references and arbitrary-size integer round trips. The fixture-generation command and CPython encoder-fixture assertion are documented in the test file.
Validated with Node.js 24.19.0: 272 Node API tests and 2,285 operation tests passed.