Show More
@@ -43,6 +43,8 b' def serialize_binary_message(msg):' | |||||
43 | # don't modify msg or buffer list in-place |
|
43 | # don't modify msg or buffer list in-place | |
44 | msg = msg.copy() |
|
44 | msg = msg.copy() | |
45 | buffers = list(msg.pop('buffers')) |
|
45 | buffers = list(msg.pop('buffers')) | |
|
46 | # for python 2, copy the buffer memoryviews to byte strings | |||
|
47 | buffers = [x.tobytes() for x in buffers] | |||
46 | bmsg = json.dumps(msg, default=date_default).encode('utf8') |
|
48 | bmsg = json.dumps(msg, default=date_default).encode('utf8') | |
47 | buffers.insert(0, bmsg) |
|
49 | buffers.insert(0, bmsg) | |
48 | nbufs = len(buffers) |
|
50 | nbufs = len(buffers) |
General Comments 0
You need to be logged in to leave comments.
Login now