Skip to content

Serialisation notes

Alex Willmer edited this page Jan 12, 2026 · 2 revisions

Constraints and requirements

  • Concerned with Python <-> Python. Javascript treatment of integers outside float64 is a non-issue.
  • Require compatibility with all supported Python versions (2.4 - 2.7, >= 3.6)
  • If using code outside stdlib, then must be able to bootstrap mitogen.core.Importer before relying on it.

Formats

Marshal

Stdlib module used to dump/load .pyc files. Docs warn "Not a general persistence module", "Details of the format are undocumented on purpose", "Python maintainers reserve the right to modify the marshal format in backward incompatible ways", "Warning The marshal module is not intended to be secure against erroneous or maliciously constructed data", and so on.

Version Python Changes
0
1 >= 2.4 Interned strings
2 >= 2.5 Binary float format
3 >= 3.4 Object instancing and recursion
4 >= 3.4 Effcient short strings
5 >= 3.14 Slice objects support

Pickle

stdlib module, currently used by Mitogen (Jan 2026).

Protocol Python PEPs Changes
0 ASCII
1 Binary
2 >= 2.3 PEP-307 New-style classes
3 >= 3.0 Explicit bytes support
4 >= 3.4 PEP-3154 Strings > 2**32 , sets, framing
5 >= 3.8 PEP-574 Out of band data

See also

Clone this wiki locally