[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX

Ronald Oussoren report at bugs.python.org
Mon Aug 4 13:55:02 CEST 2014


Ronald Oussoren added the comment:

BTW. There is also an argument to be made against my patch and for a documentation update: it is unclear to me if clang ever creates _Bool false values where the bit pattern isn't exactly the same as the zero value of an integer of the same size (for example due to generated code only updating the least significant bit and starting with a uninitialised value that has some of the other bits set).  If it does so depends on what's more efficient to do in machine code, and my knowledge of assembly is too rusty to have anything useful to say about that (although I'd suspect that overwriting the complete _Bool value would be more efficient than loading the current value, updating the LSB and storing it again).

If it can do so the current behavior of struct.unpack would be more correct than the version you get after applying my patch.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22012>
_______________________________________


More information about the Python-bugs-list mailing list