blob: ae324382458922e29332e59dc6305aafa19ba789 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# test ustruct and endian specific things
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
# unpack/unpack_from with unaligned native type
buf = b'0123456789'
print(struct.unpack('h', memoryview(buf)[1:3]))
print(struct.unpack_from('i', buf, 1))
print(struct.unpack_from('@i', buf, 1))
print(struct.unpack_from('@ii', buf, 1))
|