distributed: Allow None/False/True in AIR's MsgPack encoder.

This commit is contained in:
Sam Edwards 2014-05-12 10:18:11 -06:00
parent 785354d3f3
commit a697ce3f05
1 changed files with 7 additions and 1 deletions

View File

@ -26,7 +26,13 @@ def msgpack_length(dg, length, fix, maxfix, tag8, tag16, tag32):
raise ValueError('Value too big for MessagePack')
def msgpack_encode(dg, element):
if isinstance(element, (int, long)):
if element == None:
dg.addUint8(0xc0)
elif element == False:
dg.addUint8(0xc2)
elif element == True:
dg.addUint8(0xc3)
elif isinstance(element, (int, long)):
if -32 <= element < 128:
dg.addInt8(element)
elif 128 <= element < 256: