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

The docs for native mode (we now always assume C99):

"The '?' conversion code corresponds to the _Bool type defined by C99."


The memoryview tests that fail are essentially auto-generated and not
prescriptive. They just happened to work without UBSan:


>>> x = array.array("B", [0,1,2,3])
>>> m = memoryview(x)
>>> m.format
'B'
>>> c = m.cast("?") # Wrong!
>>> c.tolist()
[False, True, True, True]


I don't see the point in working around UB for the purposes of
displaying the wrong cast.

If you do subsequent array operations with the variable "c", UB will happen 
there.



In theory you can do the same with a cast from unsigned to signed
integers. Signed integers are allowed to be trap representations,
though I don't know an actual platform where this is the case.

----------

_______________________________________
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