[issue39689] struct and memoryview tests rely on undefined behavior (as revealed by clang 9)

Stefan Krah report at bugs.python.org
Thu Mar 12 15:11:20 EDT 2020


Stefan Krah <stefan at bytereef.org> added the comment:

memoryview only supports the native format, so I've disabled the
(wrong) test that casts arrays with arbitrary values to _Bool. So
memoryview is done.


IMO the problem in _struct is that it swaps the x->unpack function
for the native one, which does not seem right for _Bool:

        /* Scan through the native table, find a matching
           entry in the endian table and swap in the
           native implementations whenever possible
           (64-bit platforms may not have "standard" sizes) */

If one disables that swap, the tests pass here.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39689>
_______________________________________


More information about the Python-bugs-list mailing list