From 4881a52ac61da6334ee1718b1d0189d705d6d0ca Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Fri, 18 Mar 2016 19:34:21 -0600 Subject: [PATCH] UnicodeType added to thrift serialization to support h5py 2.0+ --- dynamicserialize/ThriftSerializationContext.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dynamicserialize/ThriftSerializationContext.py b/dynamicserialize/ThriftSerializationContext.py index fdb1ae0..89d6127 100644 --- a/dynamicserialize/ThriftSerializationContext.py +++ b/dynamicserialize/ThriftSerializationContext.py @@ -36,6 +36,7 @@ # 06/09/10 njensen Initial Creation. # 06/12/13 #2099 dgilling Implement readObject() and # writeObject(). +# 03/18/16 mjames@ucar Add types.UnicodeType # # @@ -65,6 +66,7 @@ buildObjMap(dstypes) pythonToThriftMap = { types.StringType: TType.STRING, + types.UnicodeType: TType.STRING, types.IntType: TType.I32, types.LongType: TType.I64, types.ListType: TType.LIST, @@ -237,7 +239,7 @@ class ThriftSerializationContext(object): return result def _lookupType(self, obj): - pyt = type(obj) + pyt = type(obj) # for h5py 2.0+ if pythonToThriftMap.has_key(pyt): return pythonToThriftMap[pyt] elif pyt.__module__.startswith('dynamicserialize.dstypes'):