Browse Source
With this patch alignment is done relative to the start of the buffer that is being unpacked, not the raw pointer value, as per CPython. Fixes issue #3314.pull/5061/head
Tom McDermott
5 years ago
committed by
Damien George
5 changed files with 24 additions and 6 deletions
@ -0,0 +1,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)) |
Loading…
Reference in new issue