diff --git a/distributed/protocol/numpy.py b/distributed/protocol/numpy.py index e146df937e8..e963d557ca3 100644 --- a/distributed/protocol/numpy.py +++ b/distributed/protocol/numpy.py @@ -50,7 +50,7 @@ def serialize_numpy_ndarray(x): data = x.view('u1').data - if blosc and data.nbytes > 1e5: + if blosc and x.nbytes > 1e5: frames = frame_split_size([data]) if sys.version_info.major == 2: frames = [ensure_bytes(frame) for frame in frames] diff --git a/distributed/protocol/tests/test_numpy.py b/distributed/protocol/tests/test_numpy.py index 8b976dedbb2..3f23b044111 100644 --- a/distributed/protocol/tests/test_numpy.py +++ b/distributed/protocol/tests/test_numpy.py @@ -138,4 +138,5 @@ def test_dont_compress_uncompressable_data(): x = np.ones(100) header, [data] = serialize(x) assert 'compression' not in header - assert data.obj.ctypes.data == x.ctypes.data + if isinstance(data, memoryview): + assert data.obj.ctypes.data == x.ctypes.data