Stefan Krah <ste...@bytereef.org> added the comment:

I checked that NumPy also packs correctly:

>>> import numpy as np
>>> x = np.array([0,1,2,3], dtype=np.bool)
>>> x.tobytes()
b'\x00\x01\x01\x01'

So I vote for not handling incorrectly packed values and removing
"and any non-zero value will be True when unpacking" from the docs,
which does not seem to make any sense for _Bool.

memoryview also does not guard against the theoretical possibility
of incorrectly packed values being trap representations. Values need
to be packed correctly, or you get UB.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39689>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to