Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4abb13b

Browse files
committed
Add check to skip work in versions past 3.4
1 parent f1398d6 commit 4abb13b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

IPython/html/base/zmqhandlers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import json
99
import struct
1010
import warnings
11+
import sys
1112

1213
try:
1314
from urllib.parse import urlparse # Py 3
@@ -43,8 +44,8 @@ def serialize_binary_message(msg):
4344
# don't modify msg or buffer list in-place
4445
msg = msg.copy()
4546
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]
4849
bmsg = json.dumps(msg, default=date_default).encode('utf8')
4950
buffers.insert(0, bmsg)
5051
nbufs = len(buffers)

0 commit comments

Comments
 (0)