You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
u-msgpack-python is a lightweight [MessagePack](http://msgpack.org/) serializer and deserializer module written in pure Python, compatible with both Python 2 and 3, as well CPython and PyPy implementations of Python. u-msgpack-python is fully compliant with the latest [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md). In particular, it supports the new binary, UTF-8 string, and application-defined ext types.
3
+
u-msgpack-python is a lightweight [MessagePack](http://msgpack.org/) serializer and deserializer module written in pure Python, compatible with both Python 2 and 3, as well CPython and PyPy implementations of Python. u-msgpack-python is fully compliant with the latest [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md). In particular, it supports the new binary, UTF-8 string, application-defined ext, and timestamp types.
4
4
5
5
u-msgpack-python is currently distributed on [PyPI](https://pypi.python.org/pypi/u-msgpack-python) and as a single file: [umsgpack.py](https://raw.github.com/vsergeev/u-msgpack-python/master/umsgpack.py).
6
6
@@ -81,18 +81,18 @@ b'\x01\x02\x03'
81
81
82
82
Serializing and deserializing application-defined types with Ext handlers:
@@ -341,6 +339,20 @@ If a non-byte-string argument is passed to `umsgpack.unpackb()`, it will raise a
341
339
>>>
342
340
```
343
341
342
+
*`UnsupportedTimestampException`: Unsupported timestamp encountered during unpacking.
343
+
344
+
The official timestamp extension type supports 32-bit, 64-bit and96-bit
345
+
formats. This exception is thrown if a timestamp extension typewith an
346
+
unsupported formatis encountered.
347
+
348
+
``` python
349
+
# Attempt to unpack invalid timestamp
350
+
>>> umsgpack.unpackb(b"\xd5\xff\x01\x02")
351
+
...
352
+
umsgpack.UnsupportedTimestampException: unsupported timestamp with data length 2
353
+
>>>
354
+
```
355
+
344
356
*`ReservedCodeException`: Reserved code encountered during unpacking.
345
357
346
358
``` python
@@ -387,6 +399,8 @@ If a non-byte-string argument is passed to `umsgpack.unpackb()`, it will raise a
387
399
* The msgpack array formatis unpacked into a Python list, unless it is the key of a map, in which case it is unpacked into a Python tuple
388
400
* Python tuples and lists are both packed into the msgpack array format
389
401
* Python float types are packed into the msgpack float32 or float64 format depending on the system's `sys.float_info`
402
+
* The Python `datetime.datetime`typeis packed into, and unpacked from, the msgpack `timestamp`format
403
+
* Note that this Python type only supports microsecond resolution, while the msgpack `timestamp`format supports nanosecond resolution. Timestamps with finer than microsecond resolution will lose precision during unpacking.
0 commit comments