From f28fdf32d19b09196cea851aa7e909de693fb1d9 2015-02-16 21:53:26 From: Jason Grout Date: 2015-02-16 21:53:26 Subject: [PATCH] Fix websocket/zmq serialization to expect memoryviews --- diff --git a/IPython/html/base/zmqhandlers.py b/IPython/html/base/zmqhandlers.py index f1159e8..eedf71e 100644 --- a/IPython/html/base/zmqhandlers.py +++ b/IPython/html/base/zmqhandlers.py @@ -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)