fallback: Fix packing multidim memoryview (#527)

Fix #526
This commit is contained in:
Inada Naoki 2023-01-18 19:13:44 +09:00 committed by GitHub
parent c3995669f1
commit b82d0b62f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -96,3 +96,11 @@ def test_bin32_from_byte():
def test_bin32_from_float():
_runtest("f", 2**16, b"\xc6", b"\x00\x01\x00\x00", True)
def test_multidim_memoryview():
# See https://github.com/msgpack/msgpack-python/issues/526
view = memoryview(b"\00" * 6)
data = view.cast(view.format, (3, 2))
packed = packb(data)
assert packed == b'\xc4\x06\x00\x00\x00\x00\x00\x00'