Skip to content

Allow default handler to take a position parameter#718

Open
PeterC-DLS wants to merge 2 commits into
msgpack:mainfrom
DiamondLightSource:add-default-handler-posn
Open

Allow default handler to take a position parameter#718
PeterC-DLS wants to merge 2 commits into
msgpack:mainfrom
DiamondLightSource:add-default-handler-posn

Conversation

@PeterC-DLS

Copy link
Copy Markdown

This enables padding to be computed when packing a custom type and enables zero-copy unpacking by aligning primitives correctly. The code in test_default demonstrates correct padding for arrays.

This is motivated by passing NumPy's ndarrays with their raw data in bin format to a web frontend where TypedArrays must be correctly aligned otherwise a copy must be taken by slicing the underlying ArrayBuffer (in the @msgpack/msgpack package). Note, the Javascript library gives access to the encoder context for extension types but this is not available for this Python library.

This enables padding to be computed when packing a custom type and
enables zero-copy unpacking by aligning primitives correctly
@methane

methane commented Jul 21, 2026

Copy link
Copy Markdown
Member

memo: msgpack/msgpack-javascript#248

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.

2 participants