THRIFT-1208. py: Compact protocol always reads and writes booleans as true

Patch: liwei

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1146180 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/protocol/TCompactProtocol.py b/lib/py/src/protocol/TCompactProtocol.py
index 280b54f..6d57aeb 100644
--- a/lib/py/src/protocol/TCompactProtocol.py
+++ b/lib/py/src/protocol/TCompactProtocol.py
@@ -204,7 +204,10 @@
             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 +341,9 @@
 
   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