UnicodeType added to thrift serialization to support h5py 2.0+

This commit is contained in:
mjames-upc 2016-03-18 19:34:21 -06:00
parent df44b1b32d
commit 4881a52ac6

View file

@ -36,6 +36,7 @@
# 06/09/10 njensen Initial Creation. # 06/09/10 njensen Initial Creation.
# 06/12/13 #2099 dgilling Implement readObject() and # 06/12/13 #2099 dgilling Implement readObject() and
# writeObject(). # writeObject().
# 03/18/16 mjames@ucar Add types.UnicodeType
# #
# #
@ -65,6 +66,7 @@ buildObjMap(dstypes)
pythonToThriftMap = { pythonToThriftMap = {
types.StringType: TType.STRING, types.StringType: TType.STRING,
types.UnicodeType: TType.STRING,
types.IntType: TType.I32, types.IntType: TType.I32,
types.LongType: TType.I64, types.LongType: TType.I64,
types.ListType: TType.LIST, types.ListType: TType.LIST,
@ -237,7 +239,7 @@ class ThriftSerializationContext(object):
return result return result
def _lookupType(self, obj): def _lookupType(self, obj):
pyt = type(obj) pyt = type(obj) # <type 'unicode'> for h5py 2.0+
if pythonToThriftMap.has_key(pyt): if pythonToThriftMap.has_key(pyt):
return pythonToThriftMap[pyt] return pythonToThriftMap[pyt]
elif pyt.__module__.startswith('dynamicserialize.dstypes'): elif pyt.__module__.startswith('dynamicserialize.dstypes'):