mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-04-13 06:20:19 +00:00
Fix overflow in unpacking timestamp to datetime (#452)
This commit is contained in:
parent
8029f95516
commit
753b3706d8
2 changed files with 14 additions and 3 deletions
|
|
@ -129,3 +129,14 @@ def test_pack_datetime():
|
|||
assert x
|
||||
assert x[0] == dt
|
||||
assert msgpack.unpackb(packed) is None
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[0] == 2, reason="datetime support is PY3+ only")
|
||||
def test_issue451():
|
||||
# https://github.com/msgpack/msgpack-python/issues/451
|
||||
dt = datetime.datetime(2100, 1, 1, 1, 1, tzinfo=_utc)
|
||||
packed = msgpack.packb(dt, datetime=True)
|
||||
assert packed == b"\xd6\xff\xf4\x86eL"
|
||||
|
||||
unpacked = msgpack.unpackb(packed, timestamp=3)
|
||||
assert dt == unpacked
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue