THRIFT-4778: fix inheritance for protocol factories
diff --git a/lib/py/src/protocol/TBinaryProtocol.py b/lib/py/src/protocol/TBinaryProtocol.py
index f6be772..6b2facc 100644
--- a/lib/py/src/protocol/TBinaryProtocol.py
+++ b/lib/py/src/protocol/TBinaryProtocol.py
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-from .TProtocol import TType, TProtocolBase, TProtocolException
+from .TProtocol import TType, TProtocolBase, TProtocolException, TProtocolFactory
 from struct import pack, unpack
 
 
@@ -235,7 +235,7 @@
         return s
 
 
-class TBinaryProtocolFactory(object):
+class TBinaryProtocolFactory(TProtocolFactory):
     def __init__(self, strictRead=False, strictWrite=True, **kwargs):
         self.strictRead = strictRead
         self.strictWrite = strictWrite
@@ -284,7 +284,7 @@
             self._fast_encode = fastbinary.encode_binary
 
 
-class TBinaryProtocolAcceleratedFactory(object):
+class TBinaryProtocolAcceleratedFactory(TProtocolFactory):
     def __init__(self,
                  string_length_limit=None,
                  container_length_limit=None,
diff --git a/lib/py/src/protocol/TCompactProtocol.py b/lib/py/src/protocol/TCompactProtocol.py
index baaec65..700e792 100644
--- a/lib/py/src/protocol/TCompactProtocol.py
+++ b/lib/py/src/protocol/TCompactProtocol.py
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-from .TProtocol import TType, TProtocolBase, TProtocolException, checkIntegerLimits
+from .TProtocol import TType, TProtocolBase, TProtocolException, TProtocolFactory, checkIntegerLimits
 from struct import pack, unpack
 
 from ..compat import binary_to_str, str_to_binary
@@ -428,7 +428,7 @@
         return TTYPES[byte & 0x0f]
 
 
-class TCompactProtocolFactory(object):
+class TCompactProtocolFactory(TProtocolFactory):
     def __init__(self,
                  string_length_limit=None,
                  container_length_limit=None):
@@ -470,7 +470,7 @@
             self._fast_encode = fastbinary.encode_compact
 
 
-class TCompactProtocolAcceleratedFactory(object):
+class TCompactProtocolAcceleratedFactory(TProtocolFactory):
     def __init__(self,
                  string_length_limit=None,
                  container_length_limit=None,
diff --git a/lib/py/src/protocol/THeaderProtocol.py b/lib/py/src/protocol/THeaderProtocol.py
index b27a749..13982e8 100644
--- a/lib/py/src/protocol/THeaderProtocol.py
+++ b/lib/py/src/protocol/THeaderProtocol.py
@@ -19,7 +19,7 @@
 
 from thrift.protocol.TBinaryProtocol import TBinaryProtocolAccelerated
 from thrift.protocol.TCompactProtocol import TCompactProtocolAccelerated
-from thrift.protocol.TProtocol import TProtocolBase, TProtocolException
+from thrift.protocol.TProtocol import TProtocolBase, TProtocolException, TProtocolFactory
 from thrift.Thrift import TApplicationException, TMessageType
 from thrift.transport.THeaderTransport import THeaderTransport, THeaderSubprotocolID, THeaderClientType
 
@@ -217,7 +217,7 @@
         return self._protocol.readBinary()
 
 
-class THeaderProtocolFactory(object):
+class THeaderProtocolFactory(TProtocolFactory):
     def __init__(self, allowed_client_types=(THeaderClientType.HEADERS,)):
         self.allowed_client_types = allowed_client_types
 
diff --git a/lib/py/src/protocol/TJSONProtocol.py b/lib/py/src/protocol/TJSONProtocol.py
index db2099a..1741702 100644
--- a/lib/py/src/protocol/TJSONProtocol.py
+++ b/lib/py/src/protocol/TJSONProtocol.py
@@ -18,7 +18,7 @@
 #
 
 from .TProtocol import (TType, TProtocolBase, TProtocolException,
-                        checkIntegerLimits)
+                        TProtocolFactory, checkIntegerLimits)
 import base64
 import math
 import sys
@@ -577,7 +577,7 @@
         self.writeJSONBase64(binary)
 
 
-class TJSONProtocolFactory(object):
+class TJSONProtocolFactory(TProtocolFactory):
     def getProtocol(self, trans):
         return TJSONProtocol(trans)
 
@@ -671,7 +671,7 @@
         self.writeJSONBase64(binary)
 
 
-class TSimpleJSONProtocolFactory(object):
+class TSimpleJSONProtocolFactory(TProtocolFactory):
 
     def getProtocol(self, trans):
         return TSimpleJSONProtocol(trans)