[New-bugs-announce] [issue28377] struct.unpack of Bool
Weihong Guan
report at bugs.python.org
Thu Oct 6 09:14:23 EDT 2016
New submission from Weihong Guan:
According to the doc:
For the '?' format character, the return value is either True or False. When packing, the truth value of the argument object is used. Either 0 or 1 in the native or standard bool representation will be packed, and any non-zero value will be True when unpacking.
But it behaves more like & 1 operation. so False for even value, and True for odd value.
unpack fmt '?H' should reqiure buff of length 3, same as 'H?', not 4.
----------
components: ctypes
files: Screen Shot 2016-10-06 at 20.59.43.png
messages: 278192
nosy: Weihong Guan
priority: normal
severity: normal
status: open
title: struct.unpack of Bool
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file44987/Screen Shot 2016-10-06 at 20.59.43.png
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28377>
_______________________________________
More information about the New-bugs-announce
mailing list