Show More
@@ -8,6 +8,7 b' import os' | |||
|
8 | 8 | import json |
|
9 | 9 | import struct |
|
10 | 10 | import warnings |
|
11 | import sys | |
|
11 | 12 | |
|
12 | 13 | try: |
|
13 | 14 | from urllib.parse import urlparse # Py 3 |
@@ -43,8 +44,8 b' def serialize_binary_message(msg):' | |||
|
43 | 44 | # don't modify msg or buffer list in-place |
|
44 | 45 | msg = msg.copy() |
|
45 | 46 | buffers = list(msg.pop('buffers')) |
|
46 | # for python 2, copy the buffer memoryviews to byte strings | |
|
47 | buffers = [x.tobytes() for x in buffers] | |
|
47 | if sys.version_info < (3, 4): | |
|
48 | buffers = [x.tobytes() for x in buffers] | |
|
48 | 49 | bmsg = json.dumps(msg, default=date_default).encode('utf8') |
|
49 | 50 | buffers.insert(0, bmsg) |
|
50 | 51 | nbufs = len(buffers) |
General Comments 0
You need to be logged in to leave comments.
Login now