Skip to content

Problem with unpacking packed multi-dimensional array  #56

Description

@Bomsw

I've been trying to use the package to work with some multi-dimensional numpy arrays, unfortunately it does not seem to work

>>> import numpy as np
>>> import msgpack_numpy
>>> packed = msgpack_numpy.packb(np.ones((3,3)))
>>> msgpack_numpy.unpackb(packed)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/msgpack_numpy.py", line 287, in unpackb
    return _unpackb(packed, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/msgpack/fallback.py", line 121, in unpackb
    ret = unpacker._unpack()
  File "/usr/local/lib/python3.9/dist-packages/msgpack/fallback.py", line 602, in _unpack
    ret = self._object_hook(ret)
  File "/usr/local/lib/python3.9/dist-packages/msgpack_numpy.py", line 103, in decode
    return np.ndarray(buffer=obj[b'data'],
TypeError: buffer is too small for requested array

I am using numpy 1.24.4, msgpack-numpy 0.4.8 and msgpack 0.5.6 on python 3.9.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions