diff options
Diffstat (limited to 'module/lib/thrift/protocol/TCompactProtocol.py')
-rw-r--r-- | module/lib/thrift/protocol/TCompactProtocol.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/module/lib/thrift/protocol/TCompactProtocol.py b/module/lib/thrift/protocol/TCompactProtocol.py index 280b54f0f..016a33171 100644 --- a/module/lib/thrift/protocol/TCompactProtocol.py +++ b/module/lib/thrift/protocol/TCompactProtocol.py @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + from TProtocol import * from struct import pack, unpack @@ -204,7 +223,10 @@ class TCompactProtocol(TProtocolBase): ctype = CompactType.FALSE self.__writeFieldHeader(ctype, self.__bool_fid) elif self.state == CONTAINER_WRITE: - self.__writeByte(int(bool)) + if bool: + self.__writeByte(CompactType.TRUE) + else: + self.__writeByte(CompactType.FALSE) else: raise AssertionError, "Invalid state in compact protocol" @@ -338,9 +360,9 @@ class TCompactProtocol(TProtocolBase): def readBool(self): if self.state == BOOL_READ: - return self.__bool_value + return self.__bool_value == CompactType.TRUE elif self.state == CONTAINER_READ: - return bool(self.__readByte()) + return self.__readByte() == CompactType.TRUE else: raise AssertionError, "Invalid state in compact protocol: %d" % self.state |