aurzenligl / prophy

prophy: fast serialization protocol
MIT License
13 stars 8 forks source link

python3: decoding a byte stream containing non ascii data ends with exception #2

Closed bronisze closed 7 years ago

bronisze commented 9 years ago

@pytest.fixture(scope = 'session') def FixedBytes(): class FixedBytes(prophy.with_metaclass(prophy.struct_generator, prophy.struct_packed)): _descriptor = [("value", prophy.bytes(size = 5))] return FixedBytes

def test_fixed_bytes_assignment(FixedBytes): x = FixedBytes() x.value = b"\x00\x00\x00\x00\xaa" str(x)

result:

x = b'\x00\x00\x00\x00\xaa'

def b(x):
  return x.decode()

E UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaa in position 4: invalid start byte

aurzenligl commented 7 years ago

Bug solved after 568 days :)