Fix bool parsing bug
This commit is contained in:
@@ -595,6 +595,9 @@ class Message(ABC):
|
||||
elif meta.proto_type in [TYPE_SINT32, TYPE_SINT64]:
|
||||
# Undo zig-zag encoding
|
||||
value = (value >> 1) ^ (-(value & 1))
|
||||
elif meta.proto_type == TYPE_BOOL:
|
||||
# Booleans use a varint encoding, so convert it to true/false.
|
||||
value = value > 0
|
||||
elif wire_type in [WIRE_FIXED_32, WIRE_FIXED_64]:
|
||||
fmt = _pack_fmt(meta.proto_type)
|
||||
value = struct.unpack(fmt, value)[0]
|
||||
|
||||
Reference in New Issue
Block a user