THRIFT-3504 Fix FastbinaryTest.py
Client: Python
Patch: Nobuaki Sukegawa

This closes #757
diff --git a/lib/py/src/protocol/fastbinary.c b/lib/py/src/protocol/fastbinary.c
index a17019b..091a617 100644
--- a/lib/py/src/protocol/fastbinary.c
+++ b/lib/py/src/protocol/fastbinary.c
@@ -290,7 +290,7 @@
 
   // i'd like to use ParseArgs here, but it seems to be a bottleneck.
   if (PyTuple_Size(spec_tuple) != 5) {
-    PyErr_Format(PyExc_TypeError, "expecting 5 arguments for spec tuple but got %d", PyTuple_Size(spec_tuple));
+    PyErr_Format(PyExc_TypeError, "expecting 5 arguments for spec tuple but got %d", (int)PyTuple_Size(spec_tuple));
     return false;
   }
 
@@ -350,7 +350,7 @@
 
 /* --- MAIN RECURSIVE OUTPUT FUNCTION -- */
 
-static int
+static bool
 output_val(PyObject* output, PyObject* value, TType type, PyObject* typeargs) {
   /*
    * Refcounting Strategy:
@@ -1185,7 +1185,6 @@
 
   case T_STRUCT: {
     StructTypeArgs parsedargs;
-    PyObject* ret;
     if (!parse_struct_args(&parsedargs, typeargs)) {
       return NULL;
     }
diff --git a/lib/py/src/transport/TTransport.py b/lib/py/src/transport/TTransport.py
index 3fe289a..92dc4cd 100644
--- a/lib/py/src/transport/TTransport.py
+++ b/lib/py/src/transport/TTransport.py
@@ -139,7 +139,8 @@
   def __init__(self, trans, rbuf_size=DEFAULT_BUFFER):
     self.__trans = trans
     self.__wbuf = BufferIO()
-    self.__rbuf = BufferIO()
+    # Pass string argument to initialize read buffer as cStringIO.InputType
+    self.__rbuf = BufferIO(b'')
     self.__rbuf_size = rbuf_size
 
   def isOpen(self):
@@ -256,7 +257,7 @@
 
   def __init__(self, trans,):
     self.__trans = trans
-    self.__rbuf = BufferIO()
+    self.__rbuf = BufferIO(b'')
     self.__wbuf = BufferIO()
 
   def isOpen(self):
@@ -364,7 +365,7 @@
     self.sasl = SASLClient(host, service, mechanism, **sasl_kwargs)
 
     self.__wbuf = BufferIO()
-    self.__rbuf = BufferIO()
+    self.__rbuf = BufferIO(b'')
 
   def open(self):
     if not self.transport.isOpen():