From 4abb13b9154d18aaef2ff438a61147d6dd02d2b7 2015-02-17 16:52:28 From: Jason Grout Date: 2015-02-17 16:52:28 Subject: [PATCH] Add check to skip work in versions past 3.4 --- diff --git a/IPython/html/base/zmqhandlers.py b/IPython/html/base/zmqhandlers.py index eedf71e..5ddb5d2 100644 --- a/IPython/html/base/zmqhandlers.py +++ b/IPython/html/base/zmqhandlers.py @@ -8,6 +8,7 @@ import os import json import struct import warnings +import sys try: from urllib.parse import urlparse # Py 3 @@ -43,8 +44,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] + if sys.version_info < (3, 4): + buffers = [x.tobytes() for x in buffers] bmsg = json.dumps(msg, default=date_default).encode('utf8') buffers.insert(0, bmsg) nbufs = len(buffers)