modstruct: Fix alignment handling issues.

Also, factor out mp_binary_get_int() function.
This commit is contained in:
Paul Sokolovsky
2014-06-25 22:25:53 +03:00
parent 5aa740c3e2
commit 7a2f166949
3 changed files with 30 additions and 19 deletions

View File

@@ -21,3 +21,7 @@ print(struct.calcsize("100sI"))
print(struct.calcsize("97sI"))
print(struct.unpack("<6sH", b"foo\0\0\0\x12\x34"))
print(struct.pack("<6sH", b"foo", 10000))
s = struct.pack("BHBI", 10, 100, 200, 300)
v = struct.unpack("BHBI", s)
print(v == (10, 100, 200, 300))