Fix websocket/zmq serialization to expect memoryviews

This commit is contained in:
Jason Grout 2015-02-16 21:53:26 +00:00
parent 10dcd71550
commit d9d089759d

View File

@ -43,6 +43,8 @@ def serialize_binary_message(msg):
# don't modify msg or buffer list in-place
msg = msg.copy()
buffers = list(msg.pop('buffers'))
# for python 2, copy the buffer memoryviews to byte strings
buffers = [x.tobytes() for x in buffers]
bmsg = json.dumps(msg, default=date_default).encode('utf8')
buffers.insert(0, bmsg)
nbufs = len(buffers)