Message364025
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. |
|
Date |
User |
Action |
Args |
2020-03-12 15:10:04 | skrah | set | recipients:
+ skrah, gregory.p.smith, mark.dickinson, vstinner, benjamin.peterson, petr.viktorin, meador.inge, cstratak, ammar2 |
2020-03-12 15:10:04 | skrah | set | messageid: <1584025804.82.0.519439657943.issue39689@roundup.psfhosted.org> |
2020-03-12 15:10:04 | skrah | link | issue39689 messages |
2020-03-12 15:10:04 | skrah | create | |
|