Behavior Notes
Python 2
unicodetype objects are packed into, and unpacked from, the MessagePackstringformatstrtype objects are packed into, and unpacked from, the MessagePackbinaryformat
Python 3
strtype objects are packed into, and unpacked from, the MessagePackstringformatbytestype objects are packed into, and unpacked from, the MessagePackbinaryformat
The MessagePack string format is strictly decoded with UTF-8 — an exception is thrown if the string bytes cannot be decoded into a valid UTF-8 string, unless the
allow_invalid_utf8option is enabledThe MessagePack array format is unpacked into a Python list, unless it is the key of a map, in which case it is unpacked into a Python tuple
Python tuples and lists are both packed into the MessagePack array format
Python float types are packed into the MessagePack float32 or float64 format depending on the system’s
sys.float_infoThe Python
datetime.datetimetype is packed into, and unpacked from, the MessagePacktimestampformatNote that the Python
datetime.datetimetype only supports microsecond resolution, while the MessagePacktimestampformat supports nanosecond resolution. Timestamps with finer than microsecond resolution will lose precision during unpacking. Users may override the packing and unpacking of the MessagePacktimestampformat with a custom type for alternate behavior.Both naive and aware timestamp are supported. Naive timestamps are packed as if they are in the UTC timezone. Timestamps are always unpacked as aware
datetime.datetimeobjects in the UTC timezone.
Ext type handlers specified in the optional
ext_handlersdictionary will overrideext_serializable()classes during packing and unpacking