lebedov/msgpack-numpy

0.4.4.1 Cannot dump incontiguous array

Closed this issue · 1 comments

import numpy as np
import msgpack
import msgpack_numpy
msgpack_numpy.patch()

x = np.zeros((128, 128))
y = x[10:100, 10:100]

msgpack.dumps(y)

Run with python3, and msgpack-numpy 0.4.4.1 (latest), it fails with:

Traceback (most recent call last):
  File "a.py", line 12, in <module>
    msgpack.dumps(y)
  File "HOME/.local/lib/python3.6/site-packages/msgpack_numpy.py", line 196, in packb
    return Packer(**kwargs).pack(o)
  File "msgpack/_packer.pyx", line 284, in msgpack._packer.Packer.pack
  File "msgpack/_packer.pyx", line 290, in msgpack._packer.Packer.pack
  File "msgpack/_packer.pyx", line 287, in msgpack._packer.Packer.pack
  File "msgpack/_packer.pyx", line 234, in msgpack._packer.Packer._pack
  File "msgpack/_packer.pyx", line 266, in msgpack._packer.Packer._pack
BufferError: memoryview: underlying buffer is not C-contiguous

However the same code works for 0.4.3.1

Fixed.